[][src]Struct bitvec::index::BitIdx

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

A semantic index of a single bit within a register R.

This type is a counter in the range 0 .. R::BITS, and marks the semantic position of a bit according to some BitOrder implementation. As an abstract counter, it can be used in arithmetic without having to go through BitOrder translation to an electrical position.

Type Parameters

  • R: The register type that these values govern.

Validity

Values of this type are required to be in the range 0 .. R::BITS. Any value outside this range will cause the program state to become invalid, and the library’s behavior is unspecified. The library will never produce such an invalid value.

Construction

This type cannot be constructed outside the bitvec crate. bitvec will construct safe values of this type, and allows users to view them and use them to construct other index types from them. All values of this type constructed by bitvec are known to be correct based on user input to the crate.

Implementations

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

pub fn position<O>(self) -> BitPos<R> where
    O: BitOrder
[src]

Computes the bit position corresponding to self under some ordering.

This forwards to O::at::<R>, and is the only public, safe, constructor for a position counter.

pub fn select<O>(self) -> BitSel<R> where
    O: BitOrder
[src]

Computes the bit selector corresponding to self under an ordering.

This forwards to O::select::<R>, and is the only public, safe, constructor for a bit selector.

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

Computes the bit selector for self as an accessor mask.

This is a type-cast over Self::select. It is one of the few public, safe, constructors of a multi-bit mask.

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

Views the internal index value.

pub fn range(
    from: Self,
    upto: BitTail<R>
) -> impl Iterator<Item = Self> + DoubleEndedIterator + ExactSizeIterator + FusedIterator
[src]

Constructs a range over all indices between a start and end point.

Because implementation details of the RangeOps family are not yet stable, and heterogenous ranges are not supported, this must be an opaque iterator rather than a direct Range<BitIdx<R>>.

Parameters

  • from: The inclusive low bound of the range. This will be the first index produced by the iterator.
  • upto: The exclusive high bound of the range. The iterator will halt before yielding an index of this value.

Returns

An opaque iterator that is equivalent to the range from .. upto.

Requirements

from must be no greater than upto.

Trait Implementations

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

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

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

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

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

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

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

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

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

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

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

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

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

impl<R> TryFrom<u8> for BitIdx<R> where
    R: BitRegister
[src]

type Error = BitIdxErr<R>

The type returned in the event of a conversion error.

Auto Trait Implementations

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

impl<R> Send for BitIdx<R>

impl<R> Sync for BitIdx<R>

impl<R> Unpin for BitIdx<R>

impl<R> UnwindSafe for BitIdx<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.