Expand description
Typed BitTorrent piece bitfield (BEP-3).
A Bitfield tracks which of a torrent’s pieces a party holds. On
the wire (the bitfield peer message) it is MSB-first: bit 0 is the
high bit of byte 0, so piece i lives at byte i / 8, bit
7 - (i % 8). Spare trailing bits (when num_pieces isn’t a
multiple of 8) MUST be zero — a peer that sets them is misbehaving,
and Bitfield::from_bytes rejects it.
Part of the ENXAME suite (theory/ENXAME.md): the peer protocol
sends/receives bitfields, the engine keeps one for “what we have” and
folds peers’ bitfields into a per-piece availability count for
rarest-first selection. Pure + allocation-stable; the kind of generic
BitTorrent bookkeeping the suite reuses everywhere.
Structs§
- Bitfield
- A fixed-length set of
num_piecesbits, MSB-first per BEP-3.
Enums§
- Error
- A typed bitfield decode failure.