Skip to main content

ReconstructShard

Trait ReconstructShard 

Source
pub trait ReconstructShard<F: Field> {
    // Required methods
    fn len(&self) -> Option<usize>;
    fn get(&mut self) -> Option<&mut [F::Elem]>;
    fn get_or_initialize(&mut self, len: usize) -> ReconstructInitResult<'_, F>;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

Something which might hold a shard.

This trait is used in reconstruction, where some of the shards may be unknown.

Required Methods§

Source

fn len(&self) -> Option<usize>

The size of the shard data; None if empty.

Source

fn get(&mut self) -> Option<&mut [F::Elem]>

Get a mutable reference to the shard data, returning None if uninitialized.

Source

fn get_or_initialize(&mut self, len: usize) -> ReconstructInitResult<'_, F>

Get a mutable reference to the shard data, initializing it to the given length if it was None. Returns an error if initialization fails.

Provided Methods§

Source

fn is_empty(&self) -> bool

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<F: Field, T: AsRef<[F::Elem]> + AsMut<[F::Elem]> + FromIterator<F::Elem>> ReconstructShard<F> for Option<T>

Source§

fn len(&self) -> Option<usize>

Source§

fn get(&mut self) -> Option<&mut [F::Elem]>

Source§

fn get_or_initialize(&mut self, len: usize) -> ReconstructInitResult<'_, F>

Source§

impl<F: Field, T: AsRef<[F::Elem]> + AsMut<[F::Elem]>> ReconstructShard<F> for (T, bool)

Source§

fn len(&self) -> Option<usize>

Source§

fn get(&mut self) -> Option<&mut [F::Elem]>

Source§

fn get_or_initialize(&mut self, len: usize) -> ReconstructInitResult<'_, F>

Implementors§

Source§

impl<F: Field, T: AsRef<[F::Elem]> + AsMut<[F::Elem]>> ReconstructShard<F> for ShardSlot<T>