[][src]Struct bitvec::indices::BitPos

pub struct BitPos<T> where
    T: BitStore
{ /* fields omitted */ }

Indicates a real electrical index within an element.

This type is produced by BitOrder implementors, and marks a specific electrical bit within a memory element, rather than BitIdx’s semantic bit.

Type Parameters

  • T: A BitStore element which provides bounds-checking information. The new constructor uses T::BITS to ensure that constructed BitPos instances are always valid to use within T elements.

Methods

impl<T> BitPos<T> where
    T: BitStore
[src]

pub fn new(pos: u8) -> Self[src]

Produce a new bit position marker at a valid position value.

BitOrder implementations should prefer this method, but may use ::new_unchecked if they can guarantee that the range invariant is upheld.

Parameters

  • pos: The bit position value to encode. It must be in the range 0 .. T::BITS.

Panics

This function panics if pos is greater than or equal to T::BITS.

pub unsafe fn new_unchecked(pos: u8) -> Self[src]

Produce a new bit position marker at any position value.

Safety

The caller must ensure that pos is less than T::BITS. BitOrder implementations should prefer ::new, which panics on range failure.

Parameters

  • pos: The bit position value to encode. This must be in the range 0 .. T::BITS.

Returns

pos wrapped in the BitPos marker type.

Panics

This function panics if pos is greater than or equal to T::BITS, but only in debug builds. It does not inspect pos in release builds.

Trait Implementations

impl<T: Clone> Clone for BitPos<T> where
    T: BitStore
[src]

impl<T: Copy> Copy for BitPos<T> where
    T: BitStore
[src]

impl<T: Debug> Debug for BitPos<T> where
    T: BitStore
[src]

impl<T: Default> Default for BitPos<T> where
    T: BitStore
[src]

impl<T> Deref for BitPos<T> where
    T: BitStore
[src]

type Target = u8

The resulting type after dereferencing.

impl<T: Eq> Eq for BitPos<T> where
    T: BitStore
[src]

impl<T: Hash> Hash for BitPos<T> where
    T: BitStore
[src]

impl<T: Ord> Ord for BitPos<T> where
    T: BitStore
[src]

impl<T: PartialEq> PartialEq<BitPos<T>> for BitPos<T> where
    T: BitStore
[src]

impl<T: PartialOrd> PartialOrd<BitPos<T>> for BitPos<T> where
    T: BitStore
[src]

impl<T> StructuralEq for BitPos<T> where
    T: BitStore
[src]

impl<T> StructuralPartialEq for BitPos<T> where
    T: BitStore
[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for BitPos<T> where
    T: RefUnwindSafe

impl<T> Send for BitPos<T>

impl<T> Sync for BitPos<T>

impl<T> Unpin for BitPos<T> where
    T: Unpin

impl<T> UnwindSafe for BitPos<T> where
    T: 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> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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.