Struct infinity_sampler::Item
source · pub struct Item<T> { /* private fields */ }Expand description
A single item in the reservoir’s buffer. This is a thin wrapper over MaybeUninit that also tracks the insertion index and initialization state.
Implementations§
source§impl<T> Item<T>
impl<T> Item<T>
sourcepub unsafe fn take_unchecked(&mut self) -> T
pub unsafe fn take_unchecked(&mut self) -> T
Take the value out of an item without checking its state. UB if the item is empty.
sourcepub fn write(
&mut self,
index: NonZeroUsize,
value: T
) -> Option<(NonZeroUsize, T)>
pub fn write( &mut self, index: NonZeroUsize, value: T ) -> Option<(NonZeroUsize, T)>
Write a new value into an item, returning the old value
sourcepub const unsafe fn assume_init_ref(&self) -> &T
pub const unsafe fn assume_init_ref(&self) -> &T
Assume the item is not empty and return a reference. UB if the item is empty.
Trait Implementations§
Auto Trait Implementations§
impl<T> RefUnwindSafe for Item<T>where
T: RefUnwindSafe,
impl<T> Send for Item<T>where
T: Send,
impl<T> Sync for Item<T>where
T: Sync,
impl<T> Unpin for Item<T>where
T: Unpin,
impl<T> UnwindSafe for Item<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