Skip to main content

Node

Struct Node 

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

A node in the immutable operation graph.

Nodes are never mutated after construction. Build them through Image rather than directly.

Implementations§

Source§

impl Node

Source

pub const fn id(&self) -> NodeId

This node’s unique identifier.

Source

pub const fn descriptor(&self) -> ImageDescriptor

The shape of this node’s output, resolved at build time.

Source

pub fn inputs(&self) -> &[Arc<Node>]

This node’s inputs, in the order the op consumes them.

Source

pub fn op(&self) -> Option<&Arc<dyn Op>>

The op this node applies, or None if it is a source.

Source

pub fn producer(&self) -> Option<&Arc<dyn Producer>>

The producer at this node, or None if it is an interior op.

Source

pub fn name(&self) -> &'static str

A short name for this node, for diagnostics.

Source

pub fn node_count(self: &Arc<Self>) -> usize

The number of nodes reachable from here, counting shared nodes once.

Useful for asserting in tests that chaining built the graph it should have, and that a shared prefix really is shared.

Trait Implementations§

Source§

impl Debug for Node

Source§

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

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

impl Drop for Node

Source§

fn drop(&mut self)

Tear the graph down iteratively.

The derived drop glue would recurse once per node: a node drops its inputs, each of which drops its inputs, and so on. A long chain — which callers build simply by chaining many ops — would then overflow the stack at teardown, aborting the process. Since an abort is exactly what the failure model forbids, teardown uses an explicit worklist.

Only uniquely-owned inputs are unwrapped: a node still shared by another branch of the DAG is left for its last owner to drop.

Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Node

§

impl !UnwindSafe for Node

§

impl Freeze for Node

§

impl Send for Node

§

impl Sync for Node

§

impl Unpin for Node

§

impl UnsafeUnpin for Node

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.