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> { ... }
fn build_expect_sum<const N: usize, T: Into<ConstError>>(
&mut self,
tag: usize,
sum_type: SumType,
input: Wire,
error: impl FnMut(usize) -> T,
) -> Result<[Wire; N], BuildError> { ... }
}
Expand description
Extend dataflow builders with methods for building unwrap operations.
Provided Methods§
Sourcefn add_panic(
&mut self,
err: ConstError,
output_row: impl IntoIterator<Item = Type>,
inputs: impl IntoIterator<Item = (Wire, Type)>,
) -> Result<BuildHandle<DataflowOpID>, BuildError>
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.
Sourcefn build_unwrap_sum<const N: usize>(
&mut self,
tag: usize,
sum_type: SumType,
input: Wire,
) -> Result<[Wire; N], BuildError>
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.
Sourcefn build_expect_sum<const N: usize, T: Into<ConstError>>(
&mut self,
tag: usize,
sum_type: SumType,
input: Wire,
error: impl FnMut(usize) -> T,
) -> Result<[Wire; N], BuildError>
fn build_expect_sum<const N: usize, T: Into<ConstError>>( &mut self, tag: usize, sum_type: SumType, input: Wire, error: impl FnMut(usize) -> T, ) -> Result<[Wire; N], BuildError>
Build an unwrap operation for a sum type to extract the variant at the given tag or panic with given message if the tag is not the expected value.
error
is a function that takes the actual tag and returns the error message
for cases where the tag is not the expected value.
§Panics
If tag
is greater than the number of variants in the sum type.
§Errors
Errors in building the unwrapping conditional.
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.