pub struct CallString(Intern<[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<[GlobalLocation]>
Implementations§
Source§impl CallString
impl CallString
Sourcepub fn new(locs: &[GlobalLocation]) -> Self
pub fn new(locs: &[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 Allocative for CallString
impl Allocative for CallString
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 moreSource§impl Debug for CallString
impl Debug for CallString
Source§impl<'de> Deserialize<'de> for CallString
impl<'de> Deserialize<'de> for CallString
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Display for CallString
impl Display for CallString
Source§impl Hash for CallString
impl Hash for CallString
Source§impl PartialEq for CallString
impl PartialEq for CallString
Source§impl Serialize for CallString
impl Serialize for CallString
impl Copy for CallString
impl Eq for CallString
impl StructuralPartialEq for CallString
Auto Trait Implementations§
impl Freeze for CallString
impl RefUnwindSafe for CallString
impl Send for CallString
impl Sync for CallString
impl Unpin for CallString
impl UnwindSafe for CallString
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.