pub enum StructuredBuffer<P: PackedField, Data: Deref<Target = [P]>> {
Buffer(FieldBuffer<P, Data>),
ZeroPadded {
inner: Box<Self>,
log_n_blocks: usize,
index: usize,
},
}Expand description
A field buffer that may hold explicit values for only one aligned block, and zero elsewhere.
Passing the structure along lets a consumer that understands it skip the zeros. A consumer
that does not calls Self::materialize.
Variants§
Buffer(FieldBuffer<P, Data>)
Every value held explicitly.
ZeroPadded
inner placed in block index of 2^log_n_blocks equal blocks, and zero everywhere else.
Implementations§
Source§impl<P: PackedField, Data: Deref<Target = [P]>> StructuredBuffer<P, Data>
impl<P: PackedField, Data: Deref<Target = [P]>> StructuredBuffer<P, Data>
Source§impl<P: PackedField, Data: VecLike<P>> StructuredBuffer<P, Data>
impl<P: PackedField, Data: VecLike<P>> StructuredBuffer<P, Data>
Sourcepub fn materialize<A>(self, alloc: &A) -> FieldBuffer<P, Data>where
A: Allocator<Vec<P> = Data>,
pub fn materialize<A>(self, alloc: &A) -> FieldBuffer<P, Data>where
A: Allocator<Vec<P> = Data>,
Writes out every value, zeros included, as one buffer.
A buffer already holding every value is returned with no copy.
Trait Implementations§
Source§impl<P: Clone + PackedField, Data: Clone + Deref<Target = [P]>> Clone for StructuredBuffer<P, Data>
impl<P: Clone + PackedField, Data: Clone + Deref<Target = [P]>> Clone for StructuredBuffer<P, Data>
Source§fn clone(&self) -> StructuredBuffer<P, Data>
fn clone(&self) -> StructuredBuffer<P, Data>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<P: Debug + PackedField, Data: Debug + Deref<Target = [P]>> Debug for StructuredBuffer<P, Data>
impl<P: Debug + PackedField, Data: Debug + Deref<Target = [P]>> Debug for StructuredBuffer<P, Data>
Source§impl<P: PackedField, Data: Deref<Target = [P]>> From<FieldBuffer<P, Data>> for StructuredBuffer<P, Data>
impl<P: PackedField, Data: Deref<Target = [P]>> From<FieldBuffer<P, Data>> for StructuredBuffer<P, Data>
Source§fn from(buffer: FieldBuffer<P, Data>) -> Self
fn from(buffer: FieldBuffer<P, Data>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<P, Data> Freeze for StructuredBuffer<P, Data>where
Data: Freeze,
impl<P, Data> RefUnwindSafe for StructuredBuffer<P, Data>where
Data: RefUnwindSafe,
impl<P, Data> Send for StructuredBuffer<P, Data>where
Data: Send,
impl<P, Data> Sync for StructuredBuffer<P, Data>where
Data: Sync,
impl<P, Data> Unpin for StructuredBuffer<P, Data>where
Data: Unpin,
impl<P, Data> UnsafeUnpin for StructuredBuffer<P, Data>where
Data: UnsafeUnpin,
impl<P, Data> UnwindSafe for StructuredBuffer<P, Data>where
Data: 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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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