Struct MachGraph

Source
pub struct MachGraph {
    pub name: String,
    pub index: u32,
    pub root: Handle,
    pub nodes: Vec<MachNode>,
}
Expand description

MachGraph. This is where nodes are organized.

Fields§

§name: String

Name of this graph.

§index: u32

Optionally used index of this graph.

§root: Handle

Root index of this graph.

§nodes: Vec<MachNode>

Nodes in this graph.

Implementations§

Source§

impl MachGraph

Implementation for MachGraph.

Source

pub fn new(name: &str) -> Self

New graph with a name.

Source

pub fn get_root(&self) -> Option<&MachNode>

Get root node reference.

Source

pub fn get_root_mut(&mut self) -> Option<&mut MachNode>

Get root node mutable reference.

Source

pub fn get_node(&self, handle: &Handle) -> Option<&MachNode>

Get node reference.

Source

pub fn get_node_mut(&mut self, handle: &Handle) -> Option<&mut MachNode>

Get node mutable reference.

Source

pub fn get_parent(&self, handle: &Handle) -> Option<&MachNode>

Get parent.

Source

pub fn push_component(&mut self, node: &Handle, component: u32)

Push a component to a node.

Source

pub fn push_child(&mut self, name: &str) -> Handle

Push a child node of root with a name.

Source

pub fn push_child_of(&mut self, name: &str, parent: &Handle) -> Handle

Push a new child node with a name and a parent.

Source

pub fn push(&mut self, node: MachNode) -> u32

Push a node to this graph. Sets index and returns it. Not used often…

Source

pub fn visit_all(&self, visitor: &impl Visitor)

Visit all nodes (not in graph order).

Source

pub fn visit_all_mut(&mut self, visitor: &mut impl Visitor)

Visit all nodes mutable (not in graph order).

Source

pub fn pre_visit(&self, visitor: &impl Visitor)

Pre-visit.

Source

pub fn pre_visit_mut(&mut self, visitor: &mut impl Visitor)

Pre-visit mutable.

Source

pub fn post_visit(&self, visitor: &impl Visitor)

Post-visit.

Source

pub fn post_visit_mut(&mut self, visitor: &mut impl Visitor)

Post-visit mutable.

Trait Implementations§

Source§

impl Debug for MachGraph

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MachGraph

Default implementation for MachGraph.

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for MachGraph

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for MachGraph

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> 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, 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,