Skip to main content

VectorRef

Type Alias VectorRef 

Source
pub type VectorRef<'a, const NBITS: usize, Repr, T, Perm = Dense> = VectorBase<NBITS, Repr, SlicePtr<'a, u8>, Ref<'a, T>, Perm>;
Expand description

A borrowed Vector.

See: VectorBase.

Aliased Type§

pub struct VectorRef<'a, const NBITS: usize, Repr, T, Perm = Dense> { /* private fields */ }

Implementations§

Source§

impl<'a, const NBITS: usize, Repr, T, Perm> VectorRef<'a, NBITS, Repr, T, Perm>
where Repr: Representation<NBITS>, Perm: PermutationStrategy<NBITS>, T: Pod,

Source

pub fn from_canonical_front( data: &'a [u8], dim: usize, ) -> Result<Self, NotCanonical>

Construct an instance of Self viewing data as the canonical layout for a vector. The canonical layout is as follows:

  • std::mem::size_of::<T>() for the metadata coefficient.
  • Self::slice_bytes(dim) for the underlying bit-slice.

Returns an error if data.len() != Self::canonical_bytes`.

Source

pub fn from_canonical_back( data: &'a [u8], dim: usize, ) -> Result<Self, NotCanonical>

Construct an instance of Self viewing data as the canonical layout for a vector. The back canonical layout is as follows:

  • Self::slice_bytes(dim) for the underlying bit-slice.
  • std::mem::size_of::<T>() for the metadata coefficient.

Returns an error if data.len() != Self::canonical_bytes`.

Source

pub unsafe fn from_canonical_unchecked(data: &'a [u8], dim: usize) -> Self

Construct a VectorRef from the raw data.

§Safety
  • data.len() must be equal to Self::canonical_bytes(dim).

This invariant is checked in debug builds and will panic if not satisfied.

Source

pub unsafe fn from_canonical_back_unchecked(data: &'a [u8], dim: usize) -> Self

Construct a VectorRef from the raw data.

§Safety
  • data.len() must be equal to Self::canonical_bytes(dim).

This invariant is checked in debug builds and will panic if not satisfied.