[][src]Trait bitvec::view::AsBits

pub trait AsBits<T> where
    T: BitStore
{ fn as_bits<O>(&self) -> &BitSlice<O, T>

Notable traits for &'a BitSlice<O, T>

impl<'a, O, T> Read for &'a BitSlice<O, T> where
    O: BitOrder,
    T: BitStore,
    BitSlice<O, T>: BitField
impl<'a, O, T> Write for &'a mut BitSlice<O, T> where
    O: BitOrder,
    T: BitStore,
    BitSlice<O, T::Alias>: BitField

    where
        O: BitOrder
; }

Views a region as an immutable bit-slice only.

This trait is an analogue to the AsRef trait, in that it enables any type to provide an immutable-only view of a bit slice.

It does not require an AsRef<[T: BitStore]> implementation, and a blanket implementation for all such types is provided. This allows you to choose whether to implement only one of AsBits<T> or AsRef<[T]>, and gain a bit-slice view with either choice.

Type Parameters

  • T: The underlying storage region.

Notes

You are not forbidden from creating multiple views with different element types to the same region, but doing so is likely to cause inconsistent and unsurprising behavior.

Refrain from implementing this trait with more than one storage argument unless you are sure that you can uphold the memory region requirements of all of them, and are aware of the behavior conflicts that may arise.

Required methods

fn as_bits<O>(&self) -> &BitSlice<O, T>

Notable traits for &'a BitSlice<O, T>

impl<'a, O, T> Read for &'a BitSlice<O, T> where
    O: BitOrder,
    T: BitStore,
    BitSlice<O, T>: BitField
impl<'a, O, T> Write for &'a mut BitSlice<O, T> where
    O: BitOrder,
    T: BitStore,
    BitSlice<O, T::Alias>: BitField
where
    O: BitOrder

Views memory as a slice of immutable bits.

Type Parameters

  • O: The bit ordering used for the region.

Parameters

  • &self: The value that is providing a bit-slice view.

Returns

An immutable view into some bits.

Loading content...

Implementors

impl<A, T> AsBits<T> for A where
    A: AsRef<[T]>,
    T: BitStore + BitRegister
[src]

Loading content...