Weave documentation
Rust referenceweave-strand

weave-strand · bitfield

Source declarations, signatures and documentation for bitfield.

Source: sigil/weave/models/strand/src/bitfield.rs. SHA-256: f88939dd54880e0585d85918942524896634ecf9b14bd8179d85498913674222.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

bitfield::Bitfield

A growable bitfield for tracking which blocks are downloaded

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Bitfield {

}

Source line: 7.

bitfield::Bitfield::new

Create a new empty bitfield

pub fn new() -> Self;

Source line: 17.

bitfield::Bitfield::with_capacity

Create a bitfield with a specific capacity

pub fn with_capacity(bits: usize) -> Self;

Source line: 25.

bitfield::Bitfield::get

Get the value of a bit

pub fn get(&self, index: usize) -> bool;

Source line: 34.

bitfield::Bitfield::set

Set a bit to a value

pub fn set(&mut self, index: usize, value: bool);

Source line: 46.

bitfield::Bitfield::count

Count the number of set bits

pub fn count(&self) -> usize;

Source line: 71.

bitfield::Bitfield::len

Get the length in bits

pub fn len(&self) -> usize;

Source line: 76.

bitfield::Bitfield::is_empty

Check if the bitfield is empty

pub fn is_empty(&self) -> bool;

Source line: 81.

bitfield::Bitfield::clear

Clear all bits

pub fn clear(&mut self);

Source line: 86.

bitfield::Bitfield::iter

Get an iterator over set bit indices

pub fn iter(&self) -> BitfieldIterator<'_>;

Source line: 92.

bitfield::Bitfield::from_bytes

Create a bitfield from raw bytes

pub fn from_bytes(bytes: Vec<u8>) -> Self;

Source line: 100.

bitfield::Bitfield::as_bytes

Get the raw bytes

pub fn as_bytes(&self) -> &[u8];

Source line: 112.

bitfield::Bitfield::get_range

Get a range of bits

pub fn get_range(&self, start: usize, end: usize) -> Vec<bool>;

Source line: 117.

bitfield::Bitfield::set_range

Set a range of bits

pub fn set_range(&mut self, start: usize, end: usize, value: bool);

Source line: 122.

bitfield::Bitfield::first_unset

Find the first unset bit

pub fn first_unset(&self) -> Option<usize>;

Source line: 129.

bitfield::Bitfield::last_set

Find the last set bit

pub fn last_set(&self) -> Option<usize>;

Source line: 146.

bitfield::BitfieldIterator

Iterator over set bits in a bitfield

pub struct BitfieldIterator<'a> {

}

Source line: 168.

On this page