Skip to main content

AsFloatVectorWithBitsKernel

Trait AsFloatVectorWithBitsKernel 

Source
pub trait AsFloatVectorWithBitsKernel<O: FloatVector, const N: usize> {
    type Output;

    // Required method
    fn with_bits<V: FloatVectorWithBits<Element = O::Element, Lanes = O::Lanes, Mask = O::Mask, Signed = O::Signed, Unsigned = O::Unsigned, ExtendedPrecision = O::ExtendedPrecision> + CastVector<O>>(
        self,
        v: [V; N],
    ) -> Self::Output;
}
Expand description

Some algorithms may benefit from being able to access the bitwise representation of floating point vectors. However, not all vectors support this functionality, and those that do may be passed as generic FloatVector. Therefore, this is a way of upcasting a FloatVector to a FloatVectorWithBits, if possible. If not possible, returns None.

Required Associated Types§

Source

type Output

Whatever the kernel body returns, threaded back out through the upcast.

Required Methods§

Source

fn with_bits<V: FloatVectorWithBits<Element = O::Element, Lanes = O::Lanes, Mask = O::Mask, Signed = O::Signed, Unsigned = O::Unsigned, ExtendedPrecision = O::ExtendedPrecision> + CastVector<O>>( self, v: [V; N], ) -> Self::Output

Runs the kernel with v re-typed as a FloatVectorWithBits.

The bound is written on the method rather than the trait so the caller stays generic over plain FloatVector. The bit-level type only exists inside this call.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§