[−][src]Struct hypercore::bitfield::Bitfield
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
Auto Trait Implementations
impl RefUnwindSafe for Bitfield
impl Send for Bitfield
impl Sync for Bitfield
impl Unpin for Bitfield
impl UnwindSafe for Bitfield
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Clear for T where
T: InitializableFromZeroed + ?Sized,
T: InitializableFromZeroed + ?Sized,
fn clear(&mut self)
impl<T> From<T> for T
[src]
impl<T> InitializableFromZeroed for T where
T: Default,
T: Default,
unsafe fn initialize(place: *mut T)
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,