Skip to main content

ShardsBitmap

Struct ShardsBitmap 

Source
pub struct ShardsBitmap<const NUM_SHARDS: usize> { /* private fields */ }
Expand description

A bit per shard, typically saying whether that shard is present.

Bit index % 64 of word index / 64 corresponds to shard index, which is the same layout reed_solomon_simd::rate::ReceivedShards uses.

Implementations§

Source§

impl<const NUM_SHARDS: usize> ShardsBitmap<NUM_SHARDS>

Source

pub const fn none() -> Self

Bitmap with no shards set

Source

pub const fn all() -> Self

Bitmap with all shards set

Source

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

Whether the shard at index is set, false if index is out of bounds

Source

pub const fn set(&mut self, index: usize)

Sets the shard at index, does nothing if index is out of bounds

Source

pub const fn unset(&mut self, index: usize)

Unsets the shard at index, does nothing if index is out of bounds

Source

pub const fn count(&self) -> usize

Number of shards that are set

Trait Implementations§

Source§

impl<const NUM_SHARDS: usize> Clone for ShardsBitmap<NUM_SHARDS>

Source§

fn clone(&self) -> ShardsBitmap<NUM_SHARDS>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const NUM_SHARDS: usize> Copy for ShardsBitmap<NUM_SHARDS>

Source§

impl<const NUM_SHARDS: usize> Debug for ShardsBitmap<NUM_SHARDS>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const NUM_SHARDS: usize> Default for ShardsBitmap<NUM_SHARDS>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const NUM_SHARDS: usize> Eq for ShardsBitmap<NUM_SHARDS>

Source§

impl<const NUM_SHARDS: usize> PartialEq for ShardsBitmap<NUM_SHARDS>

Source§

fn eq(&self, other: &ShardsBitmap<NUM_SHARDS>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<const NUM_SHARDS: usize> StructuralPartialEq for ShardsBitmap<NUM_SHARDS>

Auto Trait Implementations§

§

impl<const NUM_SHARDS: usize> Freeze for ShardsBitmap<NUM_SHARDS>
where [u64; _]: Freeze,

§

impl<const NUM_SHARDS: usize> RefUnwindSafe for ShardsBitmap<NUM_SHARDS>
where [u64; _]: RefUnwindSafe,

§

impl<const NUM_SHARDS: usize> Send for ShardsBitmap<NUM_SHARDS>
where [u64; _]: Send,

§

impl<const NUM_SHARDS: usize> Sync for ShardsBitmap<NUM_SHARDS>
where [u64; _]: Sync,

§

impl<const NUM_SHARDS: usize> Unpin for ShardsBitmap<NUM_SHARDS>
where [u64; _]: Unpin,

§

impl<const NUM_SHARDS: usize> UnsafeUnpin for ShardsBitmap<NUM_SHARDS>
where [u64; _]: UnsafeUnpin,

§

impl<const NUM_SHARDS: usize> UnwindSafe for ShardsBitmap<NUM_SHARDS>
where [u64; _]: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.