pub struct CallString(Intern<Box<[GlobalLocation]>>);
Expand description
A location within the global call-graph.
The first location is the root of the call-graph. The last location is the currently-called function.
Invariant: a call string should never be empty, i.e.,
there should always be at least one GlobalLocation
in a call-string.
Note: This type is copyable due to interning.
Tuple Fields§
§0: Intern<Box<[GlobalLocation]>>
Implementations§
Source§impl CallString
impl CallString
Sourcefn new(locs: Box<[GlobalLocation]>) -> Self
fn new(locs: Box<[GlobalLocation]>) -> Self
Create a new call string from a list of global locations.
Sourcepub fn pop(self) -> (GlobalLocation, Option<CallString>)
pub fn pop(self) -> (GlobalLocation, Option<CallString>)
Split the leaf (the current instruction) from the caller for the
function (if any) and return both. Same as (self.leaf(), self.caller())
.
Sourcepub fn single(loc: GlobalLocation) -> Self
pub fn single(loc: GlobalLocation) -> Self
Create an initial call string for the single location loc
.
Sourcepub fn leaf(self) -> GlobalLocation
pub fn leaf(self) -> GlobalLocation
Returns the leaf of the call string (the currently-called function).
Sourcepub fn caller(self) -> Option<Self>
pub fn caller(self) -> Option<Self>
Returns the call string minus the leaf. Returns None
if this location
is at the root.
Sourcepub fn iter(&self) -> impl DoubleEndedIterator<Item = GlobalLocation> + '_
pub fn iter(&self) -> impl DoubleEndedIterator<Item = GlobalLocation> + '_
Returns an iterator over the locations in the call string, starting at the leaf and going to the root.
Sourcepub fn push(self, loc: GlobalLocation) -> Self
pub fn push(self, loc: GlobalLocation) -> Self
Adds a new call site to the end of the call string.
pub fn push_front(self, loc: GlobalLocation) -> Self
pub fn is_at_root(self) -> bool
pub fn root(self) -> GlobalLocation
pub fn stable_id(self) -> usize
Sourcepub fn iter_from_root(
&self,
) -> impl DoubleEndedIterator<Item = GlobalLocation> + '_
pub fn iter_from_root( &self, ) -> impl DoubleEndedIterator<Item = GlobalLocation> + '_
Returns an iterator over the locations in the call string, starting at the root and going to the leaf.
pub fn len(self) -> usize
pub fn is_empty(self) -> bool
Trait Implementations§
Source§impl Clone for CallString
impl Clone for CallString
Source§fn clone(&self) -> CallString
fn clone(&self) -> CallString
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more