pub struct StackGraph { /* private fields */ }
Expand description
Contains all of the nodes and edges that make up a stack graph.
Implementations§
Source§impl StackGraph
impl StackGraph
Sourcepub fn add_symbol<S: AsRef<str> + ?Sized>(
&mut self,
symbol: &S,
) -> Handle<Symbol>
pub fn add_symbol<S: AsRef<str> + ?Sized>( &mut self, symbol: &S, ) -> Handle<Symbol>
Adds a symbol to the stack graph, ensuring that there’s only ever one copy of a particular symbol stored in the graph.
Sourcepub fn iter_symbols(&self) -> impl Iterator<Item = Handle<Symbol>>
pub fn iter_symbols(&self) -> impl Iterator<Item = Handle<Symbol>>
Returns an iterator over all of the handles of all of the symbols in this stack graph.
(Note that because we’re only returning handles, this iterator does not retain a
reference to the StackGraph
.)
Source§impl StackGraph
impl StackGraph
Sourcepub fn add_string<S: AsRef<str> + ?Sized>(
&mut self,
string: &S,
) -> Handle<InternedString>
pub fn add_string<S: AsRef<str> + ?Sized>( &mut self, string: &S, ) -> Handle<InternedString>
Adds an interned string to the stack graph, ensuring that there’s only ever one copy of a particular string stored in the graph.
Sourcepub fn iter_strings(&self) -> impl Iterator<Item = Handle<InternedString>>
pub fn iter_strings(&self) -> impl Iterator<Item = Handle<InternedString>>
Returns an iterator over all of the handles of all of the interned strings in this stack
graph. (Note that because we’re only returning handles, this iterator does not retain a
reference to the StackGraph
.)
Source§impl StackGraph
impl StackGraph
Sourcepub fn add_file<S: AsRef<str> + ?Sized>(
&mut self,
name: &S,
) -> Result<Handle<File>, Handle<File>>
pub fn add_file<S: AsRef<str> + ?Sized>( &mut self, name: &S, ) -> Result<Handle<File>, Handle<File>>
Adds a file to the stack graph. There can only ever be one file with a particular name in
the graph. If a file with the requested name already exists, we return Err
; if it
doesn’t already exist, we return Ok
. In both cases, the value of the result is the
file’s handle.
Sourcepub fn get_or_create_file<S: AsRef<str> + ?Sized>(
&mut self,
name: &S,
) -> Handle<File>
pub fn get_or_create_file<S: AsRef<str> + ?Sized>( &mut self, name: &S, ) -> Handle<File>
Adds a file to the stack graph, returning its handle. There can only ever be one file with a particular name in the graph, so if you call this multiple times with the same name, you’ll get the same handle each time.
Source§impl StackGraph
impl StackGraph
Sourcepub fn nodes_for_file(
&self,
file: Handle<File>,
) -> impl Iterator<Item = Handle<Node>> + '_
pub fn nodes_for_file( &self, file: Handle<File>, ) -> impl Iterator<Item = Handle<Node>> + '_
Returns an iterator of all of the nodes that belong to a particular file. Note that this does not include the singleton root or jump to scope nodes.
Sourcepub fn iter_files(&self) -> impl Iterator<Item = Handle<File>> + '_
pub fn iter_files(&self) -> impl Iterator<Item = Handle<File>> + '_
Returns an iterator over all of the handles of all of the files in this stack graph. (Note
that because we’re only returning handles, this iterator does not retain a reference to
the StackGraph
.)
Source§impl StackGraph
impl StackGraph
Sourcepub fn jump_to_node() -> Handle<Node>
pub fn jump_to_node() -> Handle<Node>
Returns a handle to the stack graph’s singleton jump to scope node.
Sourcepub fn new_node_id(&mut self, file: Handle<File>) -> NodeID
pub fn new_node_id(&mut self, file: Handle<File>) -> NodeID
Returns an unused NodeID
for the given file.
Sourcepub fn iter_nodes(&self) -> impl Iterator<Item = Handle<Node>>
pub fn iter_nodes(&self) -> impl Iterator<Item = Handle<Node>>
Returns an iterator of all of the nodes in the graph. (Note that because we’re only
returning handles, this iterator does not retain a reference to the StackGraph
.)
Source§impl StackGraph
impl StackGraph
Source§impl StackGraph
impl StackGraph
Source§impl StackGraph
impl StackGraph
Source§impl StackGraph
impl StackGraph
Source§impl StackGraph
impl StackGraph
Source§impl StackGraph
impl StackGraph
Source§impl StackGraph
impl StackGraph
Sourcepub fn add_edge(
&mut self,
source: Handle<Node>,
sink: Handle<Node>,
precedence: i32,
)
pub fn add_edge( &mut self, source: Handle<Node>, sink: Handle<Node>, precedence: i32, )
Adds a new edge to the stack graph.
Sourcepub fn set_edge_precedence(
&mut self,
source: Handle<Node>,
sink: Handle<Node>,
precedence: i32,
)
pub fn set_edge_precedence( &mut self, source: Handle<Node>, sink: Handle<Node>, precedence: i32, )
Sets edge precedence of the given edge.
Sourcepub fn outgoing_edges(
&self,
source: Handle<Node>,
) -> impl Iterator<Item = Edge> + '_
pub fn outgoing_edges( &self, source: Handle<Node>, ) -> impl Iterator<Item = Edge> + '_
Returns an iterator of all of the edges that begin at a particular source node.
Sourcepub fn incoming_edge_degree(&self, sink: Handle<Node>) -> Degree
pub fn incoming_edge_degree(&self, sink: Handle<Node>) -> Degree
Returns the number of edges that end at a particular sink node.
Source§impl StackGraph
impl StackGraph
Sourcepub fn source_info(&self, node: Handle<Node>) -> Option<&SourceInfo>
pub fn source_info(&self, node: Handle<Node>) -> Option<&SourceInfo>
Returns information about the source code that a stack graph node represents.
Sourcepub fn source_info_mut(&mut self, node: Handle<Node>) -> &mut SourceInfo
pub fn source_info_mut(&mut self, node: Handle<Node>) -> &mut SourceInfo
Returns a mutable reference to the information about the source code that a stack graph node represents.
Source§impl StackGraph
impl StackGraph
Sourcepub fn node_debug_info(&self, node: Handle<Node>) -> Option<&DebugInfo>
pub fn node_debug_info(&self, node: Handle<Node>) -> Option<&DebugInfo>
Returns debug information about the stack graph node.
Sourcepub fn node_debug_info_mut(&mut self, node: Handle<Node>) -> &mut DebugInfo
pub fn node_debug_info_mut(&mut self, node: Handle<Node>) -> &mut DebugInfo
Returns a mutable reference to the debug info about the stack graph node.
Source§impl StackGraph
impl StackGraph
Sourcepub fn new() -> StackGraph
pub fn new() -> StackGraph
Creates a new, initially empty stack graph.
Sourcepub fn add_from_graph(
&mut self,
other: &StackGraph,
) -> Result<Vec<Handle<File>>, Handle<File>>
pub fn add_from_graph( &mut self, other: &StackGraph, ) -> Result<Vec<Handle<File>>, Handle<File>>
Copies the given stack graph into this stack graph. Panics if any of the files in the other stack graph are already defined in the current one.
Source§impl StackGraph
impl StackGraph
pub fn to_serializable(&self) -> StackGraph
pub fn to_serializable_filter<'a>(&self, f: &'a dyn Filter) -> StackGraph
Source§impl StackGraph
impl StackGraph
pub fn to_html_string( &self, title: &str, partials: &mut PartialPaths, db: &mut Database, filter: &dyn Filter, ) -> Result<String, Error>
Trait Implementations§
Source§impl Default for StackGraph
impl Default for StackGraph
Source§fn default() -> StackGraph
fn default() -> StackGraph
Source§impl Index<Handle<InternedString>> for StackGraph
impl Index<Handle<InternedString>> for StackGraph
Auto Trait Implementations§
impl Freeze for StackGraph
impl RefUnwindSafe for StackGraph
impl Send for StackGraph
impl Sync for StackGraph
impl Unpin for StackGraph
impl UnwindSafe for StackGraph
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> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.