Struct StackGraph

Source
pub struct StackGraph { /* private fields */ }
Expand description

Contains all of the nodes and edges that make up a stack graph.

Implementations§

Source§

impl StackGraph

Source

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.

Source

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

Source

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.

Source

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

Source

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.

Source

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

pub fn get_file<S: AsRef<str> + ?Sized>(&self, name: &S) -> Option<Handle<File>>

Returns the file with a particular name, if it exists.

Source§

impl StackGraph

Source

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.

Source

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

Source

pub fn jump_to_node() -> Handle<Node>

Returns a handle to the stack graph’s singleton jump to scope node.

Source

pub fn root_node() -> Handle<Node>

Returns a handle to the stack graph’s singleton root node.

Source

pub fn new_node_id(&mut self, file: Handle<File>) -> NodeID

Returns an unused NodeID for the given file.

Source

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

pub fn node_for_id(&self, id: NodeID) -> Option<Handle<Node>>

Returns the handle to the node with a particular ID, if it exists.

Source§

impl StackGraph

Source

pub fn add_drop_scopes_node(&mut self, id: NodeID) -> Option<Handle<Node>>

Adds a drop scopes node to the stack graph.

Source§

impl StackGraph

Source

pub fn add_pop_scoped_symbol_node( &mut self, id: NodeID, symbol: Handle<Symbol>, is_definition: bool, ) -> Option<Handle<Node>>

Adds a pop scoped symbol node to the stack graph.

Source§

impl StackGraph

Source

pub fn add_pop_symbol_node( &mut self, id: NodeID, symbol: Handle<Symbol>, is_definition: bool, ) -> Option<Handle<Node>>

Adds a pop symbol node to the stack graph.

Source§

impl StackGraph

Source

pub fn add_push_scoped_symbol_node( &mut self, id: NodeID, symbol: Handle<Symbol>, scope: NodeID, is_reference: bool, ) -> Option<Handle<Node>>

Adds a push scoped symbol node to the stack graph.

Source§

impl StackGraph

Source

pub fn add_push_symbol_node( &mut self, id: NodeID, symbol: Handle<Symbol>, is_reference: bool, ) -> Option<Handle<Node>>

Adds a push symbol node to the stack graph.

Source§

impl StackGraph

Source

pub fn add_scope_node( &mut self, id: NodeID, is_exported: bool, ) -> Option<Handle<Node>>

Adds a scope node to the stack graph.

Source§

impl StackGraph

Source

pub fn add_edge( &mut self, source: Handle<Node>, sink: Handle<Node>, precedence: i32, )

Adds a new edge to the stack graph.

Source

pub fn set_edge_precedence( &mut self, source: Handle<Node>, sink: Handle<Node>, precedence: i32, )

Sets edge precedence of the given edge.

Source

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.

Source

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

Source

pub fn source_info(&self, node: Handle<Node>) -> Option<&SourceInfo>

Returns information about the source code that a stack graph node represents.

Source

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

Source

pub fn node_debug_info(&self, node: Handle<Node>) -> Option<&DebugInfo>

Returns debug information about the stack graph node.

Source

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

pub fn edge_debug_info( &self, source: Handle<Node>, sink: Handle<Node>, ) -> Option<&DebugInfo>

Returns debug information about the stack graph edge.

Source

pub fn edge_debug_info_mut( &mut self, source: Handle<Node>, sink: Handle<Node>, ) -> &mut DebugInfo

Returns a mutable reference to the debug info about the stack graph edge.

Source§

impl StackGraph

Source

pub fn new() -> StackGraph

Creates a new, initially empty stack graph.

Source

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

Source

pub fn to_serializable(&self) -> StackGraph

Source

pub fn to_serializable_filter<'a>(&self, f: &'a dyn Filter) -> StackGraph

Source§

impl StackGraph

Source

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

Source§

fn default() -> StackGraph

Returns the “default value” for a type. Read more
Source§

impl Index<Handle<File>> for StackGraph

Source§

type Output = File

The returned type after indexing.
Source§

fn index(&self, handle: Handle<File>) -> &File

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<Handle<InternedString>> for StackGraph

Source§

type Output = str

The returned type after indexing.
Source§

fn index(&self, handle: Handle<InternedString>) -> &str

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<Handle<Node>> for StackGraph

Source§

type Output = Node

The returned type after indexing.
Source§

fn index(&self, handle: Handle<Node>) -> &Node

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<Handle<Symbol>> for StackGraph

Source§

type Output = str

The returned type after indexing.
Source§

fn index(&self, handle: Handle<Symbol>) -> &str

Performs the indexing (container[index]) operation. Read more
Source§

impl IndexMut<Handle<Node>> for StackGraph

Source§

fn index_mut(&mut self, handle: Handle<Node>) -> &mut Node

Performs the mutable indexing (container[index]) operation. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Conv for T

Source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<T> FmtForward for T

Source§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
Source§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
Source§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
Source§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
Source§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
Source§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
Source§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
Source§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
Source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pipe for T
where T: ?Sized,

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
Source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
Source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows 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
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows 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
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
Source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

impl<T> Tap for T

Source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
Source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
Source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
Source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
Source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
Source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
Source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
Source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
Source§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
Source§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .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
where Self: BorrowMut<B>, B: ?Sized,

Calls .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
where Self: AsRef<R>, R: ?Sized,

Calls .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
where Self: AsMut<R>, R: ?Sized,

Calls .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
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> TryConv for T

Source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.