pub struct ShardSlot<T> { /* private fields */ }Expand description
A reusable shard container for reconstruction workflows.
Unlike Option<Vec<_>>, this keeps ownership of the backing buffer even when
the shard is marked missing, which lets callers reuse preallocated storage
across repeated reconstruct calls.
Implementations§
Source§impl<T> ShardSlot<T>
impl<T> ShardSlot<T>
Sourcepub fn new_present(data: T) -> Self
pub fn new_present(data: T) -> Self
Create a shard slot whose data is already present.
Sourcepub fn new_missing(data: T) -> Self
pub fn new_missing(data: T) -> Self
Create a shard slot whose buffer exists but is currently marked missing.
Sourcepub fn with_present(data: T, present: bool) -> Self
pub fn with_present(data: T, present: bool) -> Self
Create a shard slot with an explicit presence flag.
Sourcepub fn is_present(&self) -> bool
pub fn is_present(&self) -> bool
Returns whether the shard is currently marked present.
Sourcepub fn mark_present(&mut self)
pub fn mark_present(&mut self)
Mark the shard as present.
Sourcepub fn mark_missing(&mut self)
pub fn mark_missing(&mut self)
Mark the shard as missing while retaining ownership of its buffer.
Sourcepub fn as_inner_mut(&mut self) -> &mut T
pub fn as_inner_mut(&mut self) -> &mut T
Mutably access the inner storage regardless of presence state.
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consume the slot and return the inner storage.
Trait Implementations§
impl<T: Eq> Eq for ShardSlot<T>
Source§impl<F: Field, T: AsRef<[F::Elem]> + AsMut<[F::Elem]>> ReconstructShard<F> for ShardSlot<T>
impl<F: Field, T: AsRef<[F::Elem]> + AsMut<[F::Elem]>> ReconstructShard<F> for ShardSlot<T>
Source§fn get(&mut self) -> Option<&mut [F::Elem]>
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>
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.fn is_empty(&self) -> bool
impl<T: PartialEq> StructuralPartialEq for ShardSlot<T>
Auto Trait Implementations§
impl<T> Freeze for ShardSlot<T>where
T: Freeze,
impl<T> RefUnwindSafe for ShardSlot<T>where
T: RefUnwindSafe,
impl<T> Send for ShardSlot<T>where
T: Send,
impl<T> Sync for ShardSlot<T>where
T: Sync,
impl<T> Unpin for ShardSlot<T>where
T: Unpin,
impl<T> UnsafeUnpin for ShardSlot<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ShardSlot<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more