Skip to main content

_

Trait _ 

Source
pub trait _: Sized + BitView {
    const ZERO: Self;

    // Required methods
    fn as_raw_slice(&self) -> &[Self::Store];
    fn as_raw_mut_slice(&mut self) -> &mut [Self::Store];

    // Provided method
    fn into_bitarray<O>(self) -> BitArray<Self, O>
       where O: BitOrder { ... }
}
Expand description

Helper trait for scalars and arrays, but not slices.

Required Associated Constants§

Source

const ZERO: Self

The zero constant.

Required Methods§

Source

fn as_raw_slice(&self) -> &[Self::Store]

Views the type as a slice of its elements.

Source

fn as_raw_mut_slice(&mut self) -> &mut [Self::Store]

Views the type as a mutable slice of its elements.

Provided Methods§

Source

fn into_bitarray<O>(self) -> BitArray<Self, O>
where O: BitOrder,

Wraps self in a BitArray.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T, const N: usize> BitViewSized for [T; N]
where T: BitStore,

Source§

const ZERO: [T; N]

Source§

fn as_raw_slice(&self) -> &[<[T; N] as BitView>::Store]

Source§

fn as_raw_mut_slice(&mut self) -> &mut [<[T; N] as BitView>::Store]

Implementors§

Source§

impl<T> BitViewSized for T
where T: BitStore,

Source§

const ZERO: T = <T as BitStore>::ZERO

-32">Source

fn view_bits_mut<O>(&mut self) -> &mut BitSlice<Self::Store, O>
where O: BitOrder,

Views a memory region as a mutable bit-slice.

Source

fn try_view_bits_mut<O>( &mut self, ) -> Result<&mut BitSlice<Self::Store, O>, BitSpanError<Self::Store>>
where O: BitOrder,

Attempts to view a memory region as a mutable bit-slice.

This may return an error if self is too long to view as a bit-slice.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> BitView for [T]
where T: BitStore,

Available on non-tarpaulin_include only.

Note that overly-large slices may cause the conversions to fail.

Source§

type Store = T

Source§

fn view_bits<O>(&self) -> &BitSlice<T, O>
where O: BitOrder,

Source§

fn try_view_bits<O>(&self) -> Result<&BitSlice<T, O>, BitSpanError<T>>
where O: BitOrder,

Source§

fn view_bits_mut<O>(&mut self) -> &mut BitSlice<T, O>
where O: BitOrder,

Source§

fn try_view_bits_mut<O>( &mut self, ) -> Result<&mut BitSlice<T, O>, BitSpanError<T>>
where O: BitOrder,

Source§

impl<T, const N: usize> BitView for [T; N]
where T: BitStore,

Available on non-tarpaulin_include only.

Note that overly-large arrays may cause the conversions to fail.

Source§

type Store = T

Source§

fn view_bits<O>(&self) -> &BitSlice<T, O>
where O: BitOrder,

Source§

fn try_view_bits<O>(&self) -> Result<&BitSlice<T, O>, BitSpanError<T>>
where O: BitOrder,

Source§

fn view_bits_mut<O>(&mut self) -> &mut BitSlice<T, O>
where O: BitOrder,

Source§

fn try_view_bits_mut<O>( &mut self, ) -> Result<&mut BitSlice<T, O>, BitSpanError<T>>
where O: BitOrder,

Implementors§

Source§

impl<T> BitView for T
where T: BitStore,

Available on non-tarpaulin_include only.
Source§

type Store = T