Struct bitvec::index::BitPos [−][src]
#[repr(transparent)]pub struct BitPos<R = usize> where
R: BitRegister, { /* fields omitted */ }
Expand description
Bit Position
This is a position counter of a real bit in an R
memory element.
Like BitIdx
, it is a counter in the ring 0 .. R::BITS
. It marks a real bit
in memory, and is the shift distance in the expression 1 << n
. It can only be
produced by applying BitOrder::at
to an existing BitIdx
produced by
bitvec
.
Type Parameters
R
: The register element that this position governs.
Validity
Values of this type are required to be in the range 0 .. R::BITS
. Any
value not less than R::BITS
makes the program invalid, and will likely cause
either a crash or incorrect memory access.
Construction
This type is publicly constructible, but is only correct to do so within an
implementation of BitOrder::at
. bitvec
will only request its creation
through that trait implementation, and has no sites that can publicly accept
untrusted values.
Implementations
Wraps a counter value as a known-good position within an R
register.
Parameters
pos
: The counter value to mark as a position. This must be in the range0 .. R::BITS
.
Returns
This returns Some(pos)
when it is in the valid range 0 .. R::BITS
,
and None
when it is not.
Wraps a counter value as an assumed-good position within an R
register.
Parameters
value
: The counter value to mark as a position. This must be in the range0 .. R::BITS
.
Returns
This unconditionally marks pos
as a valid bit-position.
Safety
If the pos
value is outside the valid range, then the program is
incorrect. Debug builds will panic; release builds do not inspect the
value or specify a behavior.
Removes the position wrapper, leaving the internal counter.
Computes the bit selector corresponding to self
.
This is always 1 << self.pos
.
Computes the bit selector for self
as an accessor mask.
This is a type-cast over Self::select
.
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl<R> RefUnwindSafe for BitPos<R> where
R: RefUnwindSafe,
impl<R> UnwindSafe for BitPos<R> where
R: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Causes self
to use its Binary
implementation when Debug
-formatted. Read more
Causes self
to use its Display
implementation when
Debug
-formatted. Read more
Causes self
to use its LowerExp
implementation when
Debug
-formatted. Read more
Causes self
to use its LowerHex
implementation when
Debug
-formatted. Read more
Causes self
to use its Octal
implementation when Debug
-formatted. Read more
Causes self
to use its Pointer
implementation when
Debug
-formatted. Read more
Causes self
to use its UpperExp
implementation when
Debug
-formatted. Read more
Causes self
to use its UpperHex
implementation when
Debug
-formatted. Read more
Pipes by value. This is generally the method you want to use. Read more
Borrows self
and passes that borrow into the pipe function. Read more
Mutably borrows self
and passes that borrow into the pipe function. Read more
Borrows self
, then passes self.borrow()
into the pipe function. Read more
Mutably borrows self
, then passes self.borrow_mut()
into the pipe
function. Read more
Borrows self
, then passes self.as_ref()
into the pipe function.
Mutably borrows self
, then passes self.as_mut()
into the pipe
function. Read more
Borrows self
, then passes self.deref()
into the pipe function.
Immutable access to the Borrow<B>
of a value. Read more
Mutable access to the BorrowMut<B>
of a value. Read more
Immutable access to the AsRef<R>
view of a value. Read more
Mutable access to the AsMut<R>
view of a value. Read more
Immutable access to the Deref::Target
of a value. Read more
Mutable access to the Deref::Target
of a value. Read more
Calls .tap()
only in debug builds, and is erased in release builds.
Calls .tap_mut()
only in debug builds, and is erased in release
builds. Read more
Calls .tap_borrow()
only in debug builds, and is erased in release
builds. Read more
Calls .tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read more
Calls .tap_ref()
only in debug builds, and is erased in release
builds. Read more
Calls .tap_ref_mut()
only in debug builds, and is erased in release
builds. Read more
Calls .tap_deref()
only in debug builds, and is erased in release
builds. Read more