pub trait CubeType {
type ExpandType: Clone + Init;
// Provided method
fn init(
context: &mut CubeContext,
expand: Self::ExpandType,
) -> Self::ExpandType { ... }
}Expand description
Types used in a cube function must implement this trait
Variables whose values will be known at runtime must have ExpandElement as associated type Variables whose values will be known at compile time must have the primitive type as associated type
Note: Cube functions should be written using CubeTypes, so that the code generated uses the associated ExpandType. This allows Cube code to not necessitate cloning, which is cumbersome in algorithmic code. The necessary cloning will automatically appear in the generated code.
Required Associated Types§
type ExpandType: Clone + Init
Provided Methods§
sourcefn init(context: &mut CubeContext, expand: Self::ExpandType) -> Self::ExpandType
fn init(context: &mut CubeContext, expand: Self::ExpandType) -> Self::ExpandType
Wrapper around the init method, necesary to type inference.
Object Safety§
This trait is not object safe.