[][src]Struct bitvec::index::BitSel

#[repr(transparent)]pub struct BitSel<R> where
    R: BitRegister
{ /* fields omitted */ }

A one-hot selection mask, to be applied to a register R.

This type selects exactly one bit, and is produced by the conversion of a semantic BitIdx to a BitPos through a BitOrder implementation, and then applying 1 << pos. Values of this type are used to select only the bit specified by a BitIdx when performing memory operations.

Type Parameters

  • R: The register type that these values govern.

Validity

Values of this type are required to have exactly one bit set to 1 and all other bits set to 0.

Construction

This type is only constructed from BitPos values, which are themselves only constructed by a chain of known-good BitIdx values passed into known-correct BitOrder implementations. As such, bitvec can use BitSel values with full confidence that they are correct in the surrounding context.

Implementations

impl<R> BitSel<R> where
    R: BitRegister
[src]

pub unsafe fn new(sel: R) -> Option<Self>[src]

Wraps a selector value as a known-good selection of an R register.

Parameters

  • sel: A one-hot selection mask of a bit in an R register.

Returns

If sel does not have exactly one bit set, this returns None; otherwise, it returns a BitSel wrapping the sel value.

Safety

This function must only be called within a BitOrder::select implementation that is verified to be correct.

pub unsafe fn new_unchecked(sel: R) -> Self[src]

Wraps a selector value as an assumed-good selection of an R register.

Parameters

  • sel: A one-hot selection mask of a bit in an R register.

Returns

sel wrapped in a BitSel.

Safety

sel must have exactly one bit set high and all others low. In debug builds, invalid sel values cause a panic; release builds do not check the input.

This function must only be called in a correct BitOrder::select implementation.

pub fn mask(self) -> BitMask<R> where
    R: BitRegister
[src]

Converts the selector into a bit mask.

This is a type-cast.

pub fn value(self) -> R[src]

Views the internal selector value.

pub fn range_all(
) -> impl Iterator<Item = Self> + DoubleEndedIterator + ExactSizeIterator + FusedIterator
[src]

Ranges over all possible selector values.

Trait Implementations

impl<R> Binary for BitSel<R> where
    R: BitRegister
[src]

impl<R: Clone> Clone for BitSel<R> where
    R: BitRegister
[src]

impl<R: Copy> Copy for BitSel<R> where
    R: BitRegister
[src]

impl<R> Debug for BitSel<R> where
    R: BitRegister
[src]

impl<R: Default> Default for BitSel<R> where
    R: BitRegister
[src]

impl<R> Display for BitSel<R> where
    R: BitRegister
[src]

impl<R: Eq> Eq for BitSel<R> where
    R: BitRegister
[src]

impl<R: Hash> Hash for BitSel<R> where
    R: BitRegister
[src]

impl<R: Ord> Ord for BitSel<R> where
    R: BitRegister
[src]

impl<R: PartialEq> PartialEq<BitSel<R>> for BitSel<R> where
    R: BitRegister
[src]

impl<R: PartialOrd> PartialOrd<BitSel<R>> for BitSel<R> where
    R: BitRegister
[src]

impl<R> StructuralEq for BitSel<R> where
    R: BitRegister
[src]

impl<R> StructuralPartialEq for BitSel<R> where
    R: BitRegister
[src]

impl<R> Sum<BitSel<R>> for BitMask<R> where
    R: BitRegister
[src]

Auto Trait Implementations

impl<R> RefUnwindSafe for BitSel<R> where
    R: RefUnwindSafe

impl<R> Send for BitSel<R>

impl<R> Sync for BitSel<R>

impl<R> Unpin for BitSel<R>

impl<R> UnwindSafe for BitSel<R> where
    R: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T[src]

impl<T> Conv for T[src]

impl<T> FmtForward for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized
[src]

impl<T> Pipe for T[src]

impl<T> PipeAsRef for T[src]

impl<T> PipeBorrow for T[src]

impl<T> PipeDeref for T[src]

impl<T> PipeRef for T[src]

impl<T> Tap for T[src]

impl<T> Tap for T[src]

impl<T, U> TapAsRef<U> for T where
    U: ?Sized
[src]

impl<T, U> TapBorrow<U> for T where
    U: ?Sized
[src]

impl<T> TapDeref for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> TryConv for T[src]

impl<T> TryConv for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.