Trait NodeHandle

Source
pub trait NodeHandle<N = Node>: Clone {
    const TAG: OpTag;

    // Required method
    fn node(&self) -> N;

    // Provided methods
    fn tag(&self) -> OpTag { ... }
    fn try_cast<T: NodeHandle<N> + From<N>>(&self) -> Option<T> { ... }
    fn can_hold(tag: OpTag) -> bool { ... }
}
Expand description

Common trait for handles to a node. Typically wrappers around Node.

Required Associated Constants§

Source

const TAG: OpTag

The most specific operation tag associated with the handle.

Required Methods§

Source

fn node(&self) -> N

Index of underlying node.

Provided Methods§

Source

fn tag(&self) -> OpTag

Operation tag for the handle.

Source

fn try_cast<T: NodeHandle<N> + From<N>>(&self) -> Option<T>

Cast the handle to a different more general tag.

Source

fn can_hold(tag: OpTag) -> bool

Checks whether the handle can hold an operation with the given tag.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<N: HugrNode> NodeHandle<N> for BasicBlockID<N>

Source§

const TAG: OpTag = OpTag::DataflowBlock

Source§

impl<N: HugrNode> NodeHandle<N> for CaseID<N>

Source§

const TAG: OpTag = OpTag::Case

Source§

impl<N: HugrNode> NodeHandle<N> for CfgID<N>

Source§

const TAG: OpTag = OpTag::Cfg

Source§

impl<N: HugrNode> NodeHandle<N> for ConditionalID<N>

Source§

const TAG: OpTag = OpTag::Conditional

Source§

impl<N: HugrNode> NodeHandle<N> for ConstID<N>

Source§

const TAG: OpTag = OpTag::Const

Source§

impl<N: HugrNode> NodeHandle<N> for DataflowOpID<N>

Source§

const TAG: OpTag = OpTag::DataflowChild

Source§

impl<N: HugrNode> NodeHandle<N> for DataflowParentID<N>

Source§

const TAG: OpTag = OpTag::DataflowParent

Source§

impl<N: HugrNode> NodeHandle<N> for DfgID<N>

Source§

const TAG: OpTag = OpTag::Dfg

Source§

impl<N: HugrNode> NodeHandle<N> for ModuleID<N>

Source§

const TAG: OpTag = OpTag::ModuleOp

Source§

impl<N: HugrNode> NodeHandle<N> for ModuleRootID<N>

Source§

const TAG: OpTag = OpTag::ModuleRoot

Source§

impl<N: HugrNode> NodeHandle<N> for TailLoopID<N>

Source§

const TAG: OpTag = OpTag::TailLoop

Source§

impl<N: HugrNode> NodeHandle<N> for N

Source§

const TAG: OpTag = OpTag::Any

Source§

impl<T: NodeHandle> NodeHandle for BuildHandle<T>

Source§

const TAG: OpTag = T::TAG

Source§

impl<const DEF: bool, N: HugrNode> NodeHandle<N> for AliasID<DEF, N>

Source§

const TAG: OpTag = OpTag::Alias

Source§

impl<const DEF: bool, N: HugrNode> NodeHandle<N> for FuncID<DEF, N>

Source§

const TAG: OpTag = OpTag::Function