[][src]Trait bitvec::Cursor

pub trait Cursor {
    const TYPENAME: &'static str;

    fn at<T: Bits>(cursor: BitIdx) -> BitPos;
}

A cursor over an element.

Usage

bitvec structures store and operate on semantic counts, not bit positions. The Cursor::at function takes a semantic cursor, BitIdx, and produces an electrical position, BitPos.

Associated Constants

const TYPENAME: &'static str

Loading content...

Required methods

fn at<T: Bits>(cursor: BitIdx) -> BitPos

Translate a semantic bit index into an electrical bit position.

Parameters

  • cursor: The semantic bit value. This must be in the domain 0 .. T::SIZE.

Returns

  • A concrete position. This value can be used for shifting and masking to extract a bit from an element.

Type Parameters

  • T: Bits: The storage type for which the position will be calculated.

Safety

This function requires that cursor be in the domain 0 .. T::SIZE. Implementors must check this themselves.

Loading content...

Implementors

impl Cursor for BigEndian[src]

fn at<T: Bits>(cursor: BitIdx) -> BitPos[src]

Maps a semantic count to a concrete position.

BigEndian order moves from MSb first to LSb last.

impl Cursor for LittleEndian[src]

fn at<T: Bits>(cursor: BitIdx) -> BitPos[src]

Maps a semantic count to a concrete position.

LittleEndian order moves from LSb first to LSb last.

Loading content...