hugr_core::ops::handle

Trait NodeHandle

source
pub trait NodeHandle: Clone {
    const TAG: OpTag;

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

    // Provided methods
    fn tag(&self) -> OpTag { ... }
    fn try_cast<T: NodeHandle + From<Node>>(&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) -> Node

Index of underlying node.

Provided Methods§

source

fn tag(&self) -> OpTag

Operation tag for the handle.

source

fn try_cast<T: NodeHandle + From<Node>>(&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.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl NodeHandle for Node

source§

const TAG: OpTag = OpTag::Any

source§

impl NodeHandle for BasicBlockID

source§

const TAG: OpTag = OpTag::DataflowBlock

source§

impl NodeHandle for CaseID

source§

const TAG: OpTag = OpTag::Case

source§

impl NodeHandle for CfgID

source§

const TAG: OpTag = OpTag::Cfg

source§

impl NodeHandle for ConditionalID

source§

const TAG: OpTag = OpTag::Conditional

source§

impl NodeHandle for ConstID

source§

const TAG: OpTag = OpTag::Const

source§

impl NodeHandle for DataflowOpID

source§

const TAG: OpTag = OpTag::DataflowChild

source§

impl NodeHandle for DataflowParentID

source§

const TAG: OpTag = OpTag::DataflowParent

source§

impl NodeHandle for DfgID

source§

const TAG: OpTag = OpTag::Dfg

source§

impl NodeHandle for ModuleID

source§

const TAG: OpTag = OpTag::ModuleOp

source§

impl NodeHandle for ModuleRootID

source§

const TAG: OpTag = OpTag::ModuleRoot

source§

impl NodeHandle for TailLoopID

source§

const TAG: OpTag = OpTag::TailLoop

source§

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

source§

const TAG: OpTag = T::TAG

source§

impl<const DEF: bool> NodeHandle for AliasID<DEF>

source§

const TAG: OpTag = OpTag::Alias

source§

impl<const DEF: bool> NodeHandle for FuncID<DEF>

source§

const TAG: OpTag = OpTag::Function