hugr_core::extension::prelude

Trait UnwrapBuilder

Source
pub trait UnwrapBuilder: Dataflow {
    // Provided methods
    fn add_panic(
        &mut self,
        err: ConstError,
        output_row: impl IntoIterator<Item = Type>,
        inputs: impl IntoIterator<Item = (Wire, Type)>,
    ) -> Result<BuildHandle<DataflowOpID>, BuildError> { ... }
    fn build_unwrap_sum<const N: usize>(
        &mut self,
        tag: usize,
        sum_type: SumType,
        input: Wire,
    ) -> Result<[Wire; N], BuildError> { ... }
}
Expand description

Extend dataflow builders with methods for building unwrap operations.

Provided Methods§

Source

fn add_panic( &mut self, err: ConstError, output_row: impl IntoIterator<Item = Type>, inputs: impl IntoIterator<Item = (Wire, Type)>, ) -> Result<BuildHandle<DataflowOpID>, BuildError>

Add a panic operation to the dataflow with the given error.

Source

fn build_unwrap_sum<const N: usize>( &mut self, tag: usize, sum_type: SumType, input: Wire, ) -> Result<[Wire; N], BuildError>

Build an unwrap operation for a sum type to extract the variant at the given tag or panic if the tag is not the expected value.

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§