Struct stack_graphs::graph::StackGraph[][src]

pub struct StackGraph { /* fields omitted */ }
Expand description

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

Implementations

impl StackGraph[src]

pub fn add_symbol<S: AsRef<str> + ?Sized>(
    &mut self,
    symbol: &S
) -> Handle<Symbol>
[src]

Adds a symbol to the stack graph, ensuring that there’s only ever one copy of a particular symbol stored in the graph.

pub fn iter_symbols(&self) -> impl Iterator<Item = Handle<Symbol>>[src]

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.)

impl StackGraph[src]

pub fn add_file<S: AsRef<str> + ?Sized>(
    &mut self,
    name: &S
) -> Result<Handle<File>, Handle<File>>
[src]

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.

pub fn get_or_create_file<S: AsRef<str> + ?Sized>(
    &mut self,
    name: &S
) -> Handle<File>
[src]

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.

impl StackGraph[src]

pub fn iter_files(&self) -> impl Iterator<Item = Handle<File>> + '_[src]

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.)

impl StackGraph[src]

pub fn jump_to_node(&self) -> Handle<Node>[src]

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

pub fn root_node(&self) -> Handle<Node>[src]

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

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

Returns an unused local node ID for the given file.

pub fn iter_nodes(&self) -> impl Iterator<Item = Handle<Node>>[src]

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.)

pub fn node_for_id(&self, node_id: NodeID) -> Option<Handle<Node>>[src]

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

impl StackGraph[src]

pub fn resolve_unknown_node(&mut self, node: Node) -> Result<(), &Node>[src]

Resolves an unknown node with a “real” node. Panics if there isn’t a node in the arena with the same ID as node. Returns an error is that node is not an unknown node.

impl StackGraph[src]

pub fn add_edge(&mut self, edge: Edge)[src]

Adds a new edge to the stack graph.

pub fn remove_edge(&mut self, edge: Edge)[src]

Removes an edge from the stack graph.

pub fn outgoing_edges(
    &self,
    source: Handle<Node>
) -> impl Iterator<Item = Edge> + '_
[src]

Returns an iterator of all of the edges that begin at a particular source node.

impl StackGraph[src]

pub fn new() -> StackGraph[src]

Creates a new, initially empty stack graph.

Trait Implementations

impl Index<Handle<File>> for StackGraph[src]

type Output = File

The returned type after indexing.

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

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

impl Index<Handle<Node>> for StackGraph[src]

type Output = Node

The returned type after indexing.

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

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

impl Index<Handle<Symbol>> for StackGraph[src]

type Output = Symbol

The returned type after indexing.

fn index(&self, handle: Handle<Symbol>) -> &Symbol[src]

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

impl IndexMut<Handle<Node>> for StackGraph[src]

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

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

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.