Skip to main content

VectorWithRegister

Trait VectorWithRegister 

Source
pub trait VectorWithRegister<R: Register>: GenericVector {
    // Required methods
    fn into_register(self) -> Storage<R>;
    fn from_register(reg: Storage<R>) -> Self;
    fn as_slice(&self) -> &[Self::Element];
    fn as_mut_slice(&mut self) -> &mut [Self::Element];
}
Expand description

Escape hatch tying a Vector to its specific underlying Register type.

Provides round-trip conversion between the user-facing Vector and the raw register storage. Most generic code should bound on GenericVector (or a more specific vector trait) and never need this; it exists so that code which deliberately specializes on a particular backend can drop down to the register layer without losing the trait hierarchy on the way back up.

Required Methods§

Source

fn into_register(self) -> Storage<R>

Consume the vector and yield its raw register storage.

Source

fn from_register(reg: Storage<R>) -> Self

Wrap a raw register storage value back into a Vector.

Source

fn as_slice(&self) -> &[Self::Element]

Borrow the vector’s elements as a slice.

The lane count travels as the slice length (always lanes()) rather than in the type, so this is the preferred read accessor over array-typed borrows.

Source

fn as_mut_slice(&mut self) -> &mut [Self::Element]

Mutably borrow the vector’s elements as a slice.

See as_slice.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§