Struct flowistry_pdg::pdg::CallString
source · 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 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<CallString> for CallString
impl PartialEq<CallString> for CallString
source§fn eq(&self, other: &CallString) -> bool
fn eq(&self, other: &CallString) -> bool
self
and other
values to be equal, and is used
by ==
.