Struct bitvec::indices::BitIdx [−][src]
Indicates a semantic index of a bit within a memory element.
This type is consumed by BitOrder
implementors, which use it to produce a
concrete bit position inside an element.
BitIdx
is a semantic counter which has a defined, constant, and predictable
ordering. Values of BitIdx
refer strictly to an abstract ordering, and not to
any actual bit positions within a memory element, so BitIdx::<T>(0)
is always
the first bit counted within an element, but is not required to be the most or
least significant bits, or any other particular bits. Which specific bit is
referred by a BitIdx
value is governed by implementors of BitOrder
.
Type Parameters
T
: The memory element type controlled by this index.
Implementations
impl<T> BitIdx<T> where
T: BitStore,
[src]
T: BitStore,
pub fn new(idx: u8) -> Option<Self>
[src]
Wraps a counter value as a known-good index of the T
element type.
Parameters
idx
: A semantic index within aT
memory element.
Returns
If idx
is within the range 0 .. T::BITS
, then this returns the index
value wrapped in the index type; if idx
exceeds this range, then this
returns None
.
Trait Implementations
impl<T: Clone> Clone for BitIdx<T> where
T: BitStore,
[src]
T: BitStore,
impl<T: Copy> Copy for BitIdx<T> where
T: BitStore,
[src]
T: BitStore,
impl<T: Debug> Debug for BitIdx<T> where
T: BitStore,
[src]
T: BitStore,
impl<T: Default> Default for BitIdx<T> where
T: BitStore,
[src]
T: BitStore,
impl<T> Deref for BitIdx<T> where
T: BitStore,
[src]
T: BitStore,
impl<T: Eq> Eq for BitIdx<T> where
T: BitStore,
[src]
T: BitStore,
impl<T: Hash> Hash for BitIdx<T> where
T: BitStore,
[src]
T: BitStore,
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: Ord> Ord for BitIdx<T> where
T: BitStore,
[src]
T: BitStore,
fn cmp(&self, other: &BitIdx<T>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<T: PartialEq> PartialEq<BitIdx<T>> for BitIdx<T> where
T: BitStore,
[src]
T: BitStore,
impl<T: PartialOrd> PartialOrd<BitIdx<T>> for BitIdx<T> where
T: BitStore,
[src]
T: BitStore,
fn partial_cmp(&self, other: &BitIdx<T>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T> StructuralEq for BitIdx<T> where
T: BitStore,
[src]
T: BitStore,
impl<T> StructuralPartialEq for BitIdx<T> where
T: BitStore,
[src]
T: BitStore,
Auto Trait Implementations
impl<T> RefUnwindSafe for BitIdx<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for BitIdx<T>
impl<T> Sync for BitIdx<T>
impl<T> Unpin for BitIdx<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for BitIdx<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,