Trait ArrayOpBuilder

Source
pub trait ArrayOpBuilder: GenericArrayOpBuilder {
    // Provided methods
    fn add_new_array(
        &mut self,
        elem_ty: Type,
        values: impl IntoIterator<Item = Wire>,
    ) -> Result<Wire, BuildError> { ... }
    fn add_array_unpack(
        &mut self,
        elem_ty: Type,
        size: u64,
        input: Wire,
    ) -> Result<Vec<Wire>, BuildError> { ... }
    fn add_array_clone(
        &mut self,
        elem_ty: Type,
        size: u64,
        input: Wire,
    ) -> Result<(Wire, Wire), BuildError> { ... }
    fn add_array_discard(
        &mut self,
        elem_ty: Type,
        size: u64,
        input: Wire,
    ) -> Result<(), BuildError> { ... }
    fn add_array_get(
        &mut self,
        elem_ty: Type,
        size: u64,
        input: Wire,
        index: Wire,
    ) -> Result<(Wire, Wire), BuildError> { ... }
    fn add_array_set(
        &mut self,
        elem_ty: Type,
        size: u64,
        input: Wire,
        index: Wire,
        value: Wire,
    ) -> Result<Wire, BuildError> { ... }
    fn add_array_swap(
        &mut self,
        elem_ty: Type,
        size: u64,
        input: Wire,
        index1: Wire,
        index2: Wire,
    ) -> Result<Wire, BuildError> { ... }
    fn add_array_pop_left(
        &mut self,
        elem_ty: Type,
        size: u64,
        input: Wire,
    ) -> Result<Wire, BuildError> { ... }
    fn add_array_pop_right(
        &mut self,
        elem_ty: Type,
        size: u64,
        input: Wire,
    ) -> Result<Wire, BuildError> { ... }
    fn add_array_discard_empty(
        &mut self,
        elem_ty: Type,
        input: Wire,
    ) -> Result<(), BuildError> { ... }
}
Expand description

Trait for building array operations in a dataflow graph.

Provided Methods§

Source

fn add_new_array( &mut self, elem_ty: Type, values: impl IntoIterator<Item = Wire>, ) -> Result<Wire, BuildError>

Adds a new array operation to the dataflow graph and return the wire representing the new array.

§Arguments
  • elem_ty - The type of the elements in the array.
  • values - An iterator over the values to initialize the array with.
§Errors

If building the operation fails.

§Returns

The wire representing the new array.

Source

fn add_array_unpack( &mut self, elem_ty: Type, size: u64, input: Wire, ) -> Result<Vec<Wire>, BuildError>

Adds an array unpack operation to the dataflow graph.

This operation unpacks an array into individual elements.

§Arguments
  • elem_ty - The type of the elements in the array.
  • size - The size of the array.
  • input - The wire representing the array to unpack.
§Errors

If building the operation fails.

§Returns

A vector of wires representing the individual elements from the array.

Source

fn add_array_clone( &mut self, elem_ty: Type, size: u64, input: Wire, ) -> Result<(Wire, Wire), BuildError>

Adds an array clone operation to the dataflow graph and return the wires representing the original and cloned array.

§Arguments
  • elem_ty - The type of the elements in the array.
  • size - The size of the array.
  • input - The wire representing the array.
§Errors

If building the operation fails.

§Returns

The wires representing the original and cloned array.

Source

fn add_array_discard( &mut self, elem_ty: Type, size: u64, input: Wire, ) -> Result<(), BuildError>

Adds an array discard operation to the dataflow graph.

§Arguments
  • elem_ty - The type of the elements in the array.
  • size - The size of the array.
  • input - The wire representing the array.
§Errors

If building the operation fails.

Source

fn add_array_get( &mut self, elem_ty: Type, size: u64, input: Wire, index: Wire, ) -> Result<(Wire, Wire), BuildError>

Adds an array get operation to the dataflow graph.

§Arguments
  • elem_ty - The type of the elements in the array.
  • size - The size of the array.
  • input - The wire representing the array.
  • index - The wire representing the index to get.
§Errors

If building the operation fails.

§Returns
  • The wire representing the value at the specified index in the array
  • The wire representing the array
Source

fn add_array_set( &mut self, elem_ty: Type, size: u64, input: Wire, index: Wire, value: Wire, ) -> Result<Wire, BuildError>

Adds an array set operation to the dataflow graph.

This operation sets the value at a specified index in the array.

§Arguments
  • elem_ty - The type of the elements in the array.
  • size - The size of the array.
  • input - The wire representing the array.
  • index - The wire representing the index to set.
  • value - The wire representing the value to set at the specified index.
§Errors

Returns an error if building the operation fails.

§Returns

The wire representing the updated array after the set operation.

Source

fn add_array_swap( &mut self, elem_ty: Type, size: u64, input: Wire, index1: Wire, index2: Wire, ) -> Result<Wire, BuildError>

Adds an array swap operation to the dataflow graph.

This operation swaps the values at two specified indices in the array.

§Arguments
  • elem_ty - The type of the elements in the array.
  • size - The size of the array.
  • input - The wire representing the array.
  • index1 - The wire representing the first index to swap.
  • index2 - The wire representing the second index to swap.
§Errors

Returns an error if building the operation fails.

§Returns

The wire representing the updated array after the swap operation.

Source

fn add_array_pop_left( &mut self, elem_ty: Type, size: u64, input: Wire, ) -> Result<Wire, BuildError>

Adds an array pop-left operation to the dataflow graph.

This operation removes the leftmost element from the array.

§Arguments
  • elem_ty - The type of the elements in the array.
  • size - The size of the array.
  • input - The wire representing the array.
§Errors

Returns an error if building the operation fails.

§Returns

The wire representing the Option<elemty, array<SIZE-1, elemty>>

Source

fn add_array_pop_right( &mut self, elem_ty: Type, size: u64, input: Wire, ) -> Result<Wire, BuildError>

Adds an array pop-right operation to the dataflow graph.

This operation removes the rightmost element from the array.

§Arguments
  • elem_ty - The type of the elements in the array.
  • size - The size of the array.
  • input - The wire representing the array.
§Errors

Returns an error if building the operation fails.

§Returns

The wire representing the Option<elemty, array<SIZE-1, elemty>>

Source

fn add_array_discard_empty( &mut self, elem_ty: Type, input: Wire, ) -> Result<(), BuildError>

Adds an operation to discard an empty array from the dataflow graph.

§Arguments
  • elem_ty - The type of the elements in the array.
  • input - The wire representing the array.
§Errors

Returns an error if building the operation fails.

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§