pub trait ArrayKind:
Clone
+ Copy
+ Debug
+ Display
+ Eq
+ PartialEq
+ Default
+ Send
+ Sync
+ 'static {
const EXTENSION_ID: ExtensionId;
const TYPE_NAME: TypeName;
const VALUE_NAME: ValueName;
// Required methods
fn extension() -> &'static Arc<Extension>;
fn type_def() -> &'static TypeDef;
// Provided methods
fn instantiate_custom_ty(
array_def: &TypeDef,
size: impl Into<TypeArg>,
element_ty: impl Into<TypeArg>,
) -> Result<CustomType, SignatureError> { ... }
fn instantiate_ty(
array_def: &TypeDef,
size: impl Into<TypeArg>,
element_ty: impl Into<TypeArg>,
) -> Result<Type, SignatureError> { ... }
fn custom_ty(
size: impl Into<TypeArg>,
element_ty: impl Into<TypeArg>,
) -> CustomType { ... }
fn ty(size: u64, element_ty: Type) -> Type { ... }
fn ty_parametric(
size: impl Into<TypeArg>,
element_ty: impl Into<TypeArg>,
) -> Result<Type, SignatureError> { ... }
fn build_clone<D: Dataflow>(
builder: &mut D,
elem_ty: Type,
size: u64,
arr: Wire,
) -> Result<(Wire, Wire), BuildError> { ... }
fn build_discard<D: Dataflow>(
builder: &mut D,
elem_ty: Type,
size: u64,
arr: Wire,
) -> Result<(), BuildError> { ... }
}
Expand description
Trait capturing a concrete array implementation in an extension.
Array operations are generically defined over this trait so the different
array extensions can share parts of their implementation. See for example
GenericArrayOpDef
or GenericArrayValue
Currently the available kinds of array are Array
(the default one) and
ValueArray
.
Required Associated Constants§
Sourceconst EXTENSION_ID: ExtensionId
const EXTENSION_ID: ExtensionId
Identifier of the extension containing the array.
Sourceconst VALUE_NAME: ValueName
const VALUE_NAME: ValueName
Name of the array value.
Required Methods§
Provided Methods§
Sourcefn instantiate_custom_ty(
array_def: &TypeDef,
size: impl Into<TypeArg>,
element_ty: impl Into<TypeArg>,
) -> Result<CustomType, SignatureError>
fn instantiate_custom_ty( array_def: &TypeDef, size: impl Into<TypeArg>, element_ty: impl Into<TypeArg>, ) -> Result<CustomType, SignatureError>
Instantiates an array CustomType
from its definition given a size and
element type argument.
Sourcefn instantiate_ty(
array_def: &TypeDef,
size: impl Into<TypeArg>,
element_ty: impl Into<TypeArg>,
) -> Result<Type, SignatureError>
fn instantiate_ty( array_def: &TypeDef, size: impl Into<TypeArg>, element_ty: impl Into<TypeArg>, ) -> Result<Type, SignatureError>
Instantiates an array type from its definition given a size and element type argument.
Sourcefn custom_ty(
size: impl Into<TypeArg>,
element_ty: impl Into<TypeArg>,
) -> CustomType
fn custom_ty( size: impl Into<TypeArg>, element_ty: impl Into<TypeArg>, ) -> CustomType
Instantiates an array CustomType
given a size and element type argument.
Sourcefn ty(size: u64, element_ty: Type) -> Type
fn ty(size: u64, element_ty: Type) -> Type
Instantiate a new array type given a size argument and element type.
This method is equivalent to ArrayKind::ty_parametric
, but uses concrete
arguments types to ensure no errors are possible.
Sourcefn ty_parametric(
size: impl Into<TypeArg>,
element_ty: impl Into<TypeArg>,
) -> Result<Type, SignatureError>
fn ty_parametric( size: impl Into<TypeArg>, element_ty: impl Into<TypeArg>, ) -> Result<Type, SignatureError>
Instantiate a new array type given the size and element type parameters.
This is a generic version of ArrayKind::ty
.
Sourcefn build_clone<D: Dataflow>(
builder: &mut D,
elem_ty: Type,
size: u64,
arr: Wire,
) -> Result<(Wire, Wire), BuildError>
fn build_clone<D: Dataflow>( builder: &mut D, elem_ty: Type, size: u64, arr: Wire, ) -> Result<(Wire, Wire), BuildError>
Adds a operation to a dataflow graph that clones an array of copyable values.
The default implementation uses the array clone operation.
Sourcefn build_discard<D: Dataflow>(
builder: &mut D,
elem_ty: Type,
size: u64,
arr: Wire,
) -> Result<(), BuildError>
fn build_discard<D: Dataflow>( builder: &mut D, elem_ty: Type, size: u64, arr: Wire, ) -> Result<(), BuildError>
Adds a operation to a dataflow graph that clones an array of copyable values.
The default implementation uses the array clone operation.
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.