pub struct Slot<'s> { /* private fields */ }
Expand description
Allows writing into a struct field.
Implementations§
Source§impl<'s> Slot<'s>
impl<'s> Slot<'s>
Sourcepub fn for_ptr(
ptr: NonNull<u8>,
shape: ShapeDesc,
init_mark: InitMark<'s>,
) -> Self
pub fn for_ptr( ptr: NonNull<u8>, shape: ShapeDesc, init_mark: InitMark<'s>, ) -> Self
Create a new slot for writing into a struct field — not just foo.bar
, but also
foo.2
for tuples, foo.0
for newtype wrappers, etc.
Sourcepub fn fill<T: Shapely>(self, value: T)
pub fn fill<T: Shapely>(self, value: T)
Fills the slot with a value of a concrete type. This performs a type check and panics if the type is incompatible with the slot’s shape.
If the slot is already initialized, the old value is dropped.
Sourcepub fn fill_from_partial(self, partial: Partial<'_>)
pub fn fill_from_partial(self, partial: Partial<'_>)
Fill this slot from the given partial.
This is a code smell: if you have a slot, why are you filling it from a heap-allocated partial? That’s too many allocations.
Auto Trait Implementations§
impl<'s> Freeze for Slot<'s>
impl<'s> RefUnwindSafe for Slot<'s>
impl<'s> !Send for Slot<'s>
impl<'s> !Sync for Slot<'s>
impl<'s> Unpin for Slot<'s>
impl<'s> !UnwindSafe for Slot<'s>
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