Trait cubecl::prelude::CubeType

source ·
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§

Provided Methods§

source

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.

Implementations on Foreign Types§

source§

impl CubeType for bool

source§

impl CubeType for ()

source§

impl<T> CubeType for &mut Vec<T>
where T: CubeType,

source§

impl<T> CubeType for Vec<T>
where T: CubeType,

Implementors§