[][src]Struct hypercore::bitfield::Bitfield

pub struct Bitfield {
    pub tree: SparseBitfield,
    // some fields omitted
}

Bitfield with {data, tree, index} fields.

Fields

tree: SparseBitfield

FIXME: SLEEP protocol tree field.

Implementations

impl Bitfield[src]

pub fn new() -> Self[src]

Create a new instance.

pub fn len(&self) -> u64[src]

Get the current length

pub fn is_empty(&self) -> bool[src]

Returns true if the bitfield is empty

pub fn set(&mut self, index: u64, value: bool) -> Change[src]

Set a value at an index.

pub fn get(&mut self, index: u64) -> bool[src]

Get a value at a position in the bitfield.

pub fn total(&mut self) -> u8[src]

Calculate the total for the whole data.

pub fn total_with_start(&mut self, start: u64) -> u8[src]

Calculate the total of ... TODO(yw)

pub fn total_with_range(&mut self, range: Range<u64>) -> u8[src]

Calculate the total of ... TODO(yw)

pub fn compress(&self, start: usize, length: usize) -> Result<Vec<u8>>[src]

https://github.com/mafintosh/hypercore/blob/06f3a1f573cb74ee8cfab2742455318fbf7cc3a2/lib/bitfield.js#L111-L126

pub fn iterator(&mut self) -> Iterator[src]

Constructs an iterator from start to end

pub fn iterator_with_range(&mut self, start: u64, end: u64) -> Iterator[src]

Constructs an iterator from start to end

Trait Implementations

impl Debug for Bitfield[src]

impl Default for Bitfield[src]

Auto Trait Implementations

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> Clear for T where
    T: InitializableFromZeroed + ?Sized

impl<T> From<T> for T[src]

impl<T> InitializableFromZeroed for T where
    T: Default

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,