[][src]Trait bitvec::bits::Bits

pub trait Bits {
    type Store: BitStore;
    fn bits<C>(&self) -> &BitSlice<C, Self::Store>
    where
        C: Cursor
; fn as_bitslice<C>(&self) -> &BitSlice<C, Self::Store>
    where
        C: Cursor
, { ... } }

Allows a type to be used as a sequence of immutable bits.

Requirements

This trait can only be implemented by contiguous structures: individual fundamentals, and sequences (arrays or slices) of them.

Associated Types

type Store: BitStore

The underlying fundamental type of the implementor.

Loading content...

Required methods

fn bits<C>(&self) -> &BitSlice<C, Self::Store> where
    C: Cursor

Constructs a BitSlice reference over data.

Type Parameters

  • C: Cursor: The Cursor type used to index within the slice.

Parameters

  • &self

Returns

A BitSlice handle over self’s data, using the provided Cursor type and using Self::Store as the data type.

Examples

use bitvec::prelude::*;

let src = 8u8;
let bits = src.bits::<BigEndian>();
assert!(bits[4]);
Loading content...

Provided methods

fn as_bitslice<C>(&self) -> &BitSlice<C, Self::Store> where
    C: Cursor

Deprecated since 0.16.0:

Use Bits::bits instead

Synonym for bits.

Loading content...

Implementations on Foreign Types

impl<T> Bits for [T] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 0] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 1] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 2] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 3] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 4] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 5] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 6] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 7] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 8] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 9] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 10] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 11] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 12] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 13] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 14] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 15] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 16] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 17] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 18] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 19] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 20] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 21] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 22] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 23] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 24] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 25] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 26] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 27] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 28] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 29] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 30] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 31] where
    T: BitStore
[src]

type Store = T

impl<T> Bits for [T; 32] where
    T: BitStore
[src]

type Store = T

Loading content...

Implementors

impl<T> Bits for T where
    T: BitStore
[src]

type Store = T

Loading content...