Struct bitvec::index::BitEnd[][src]

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

A semantic index counter within or one bit past the end of a register element R.

This type is a counter in the ring 0 ..= R::BITS, and serves to mark a semantic index of a dead bit after a live region. As such, following in the C++ and LLVM memory model of first-live/first-dead region descriptiors, it marks an endpoint outside some bit-region, and may be used to compute the startpoint of a bit-region immediately succeeding, but not overlapping, the source.

As a dead-bit index, this cannot be used for indexing into a register. It is used only in abstract region computation.

This type is necessary in order to preserve the distinction between a dead memory address that is not part of a buffer and a live memory address that is within a region. BitIdx is insufficient to this task, and causes buffer management errors when used in its stead.

Type Parameters

  • R: The register element that this end index governs.

Validity

Values of this type are required to be in the range 0 ..= R::BITS. Any value greater than R::BITS makes the program invalid, and will likely cause either a crash or incorrect memory access.

Construction

This type can only be publicly constructed through BitIdx::span.

Implementations

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

pub const LAST: Self[src]

The inclusive maximum tail within an element R.

pub const ZERO: Self[src]

The inclusive minimum tail within an element R.

pub fn new(value: u8) -> Option<Self>[src]

Wraps a counter value as a known-good tail of an R register.

Parameters

  • value: The counter value to mark as a tail. This must be not less than Self::ZERO and not more than Self::LAST.

Returns

This returns Some(value) when it is in the valid range 0 .. R::BITS, and None when it is not.

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

Removes the tail wrapper, leaving the internal counter.

pub fn range_from(
    from: BitIdx<R>
) -> impl Iterator<Item = Self> + DoubleEndedIterator + ExactSizeIterator + FusedIterator
[src]

Iterates over all tail indices at and after an inclusive starting point.

Because implementation details of the range type family, including the RangeBounds trait, are not yet stable, and heterogenous ranges are not yet supported, this must be an opaque iterator rather than a direct Range<BitEnd<R>>.

Parameters

  • from: The inclusive low bound of the range. This will be the first tail produced by the iterator.

Returns

An opaque iterator that is equivalent to the range from ..= Self::LAST.

pub fn span(self, len: usize) -> (usize, Self)[src]

Computes the span information for a region beginning immediately after a preceding region.

The computed region of len bits has its start at the live bit that corresponds to the self dead tail. The return value is the number of memory elements containing live bits of the computed span and its tail marker.

Parameters

  • self: A dead bit immediately after some region.
  • len: The number of live bits in the span starting after self.

Returns

  • .0: The number of elements R that contain live bits in the computed region.
  • .1: The tail counter of the first dead bit after the new span.

Behavior

If len is 0, this returns (0, self), as the span has no live bits. If self is BitEnd::LAST, then the new region starts at BitIdx::ZERO in the next element.

Trait Implementations

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

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

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

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

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

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

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

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

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

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

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

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

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

Auto Trait Implementations

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

impl<R> Send for BitEnd<R>

impl<R> Sync for BitEnd<R>

impl<R> Unpin for BitEnd<R>

impl<R> UnwindSafe for BitEnd<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> 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> Tap 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, 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.