pub struct Place<T: ?Sized> { /* private fields */ }
Expand description
A place to write a T
paired with its position in the output buffer.
Implementations§
Source§impl<T: ?Sized> Place<T>
impl<T: ?Sized> Place<T>
Sourcepub unsafe fn new_unchecked(pos: usize, ptr: *mut T) -> Self
pub unsafe fn new_unchecked(pos: usize, ptr: *mut T) -> Self
Creates a new Place
from an output pointer.
§Safety
ptr
must be properly aligned, dereferenceable, and all of its bytes
must be initialized.
Sourcepub unsafe fn from_field_unchecked<U: ?Sized>(
parent: Place<U>,
ptr: *mut T,
) -> Self
pub unsafe fn from_field_unchecked<U: ?Sized>( parent: Place<U>, ptr: *mut T, ) -> Self
Creates a new Place
from a parent pointer and the field the place
points to.
§Safety
ptr
must point to a field ofparent
ptr
must be properly aligned, dereferenceable, and all of its bytes must be initialized
Sourcepub unsafe fn ptr(&self) -> *mut T
pub unsafe fn ptr(&self) -> *mut T
Returns the pointer associated with this place.
§Safety
Uninitialized bytes must not be written to the returned pointer.
Sourcepub unsafe fn write_unchecked(&self, value: T)where
T: Sized,
pub unsafe fn write_unchecked(&self, value: T)where
T: Sized,
Writes the provided value to this place.
§Safety
value
must not have any uninitialized bytes (e.g. padding).
Sourcepub unsafe fn cast_unchecked<U>(&self) -> Place<U>where
T: Sized,
pub unsafe fn cast_unchecked<U>(&self) -> Place<U>where
T: Sized,
Trait Implementations§
Source§impl<T: ?Sized> Destructure for Place<T>
impl<T: ?Sized> Destructure for Place<T>
Source§type Underlying = T
type Underlying = T
The underlying type that is destructured.
Source§type Destructuring = Borrow
type Destructuring = Borrow
The type of destructuring to perform.
Source§fn underlying(&mut self) -> *mut Self::Underlying
fn underlying(&mut self) -> *mut Self::Underlying
Returns a mutable pointer to the underlying type.
Source§impl<T: ?Sized, U: ?Sized> Restructure<U> for Place<T>
impl<T: ?Sized, U: ?Sized> Restructure<U> for Place<T>
Source§type Restructured = Place<U>
type Restructured = Place<U>
The restructured version of this type.
Source§unsafe fn restructure(&self, ptr: *mut U) -> Self::Restructured
unsafe fn restructure(&self, ptr: *mut U) -> Self::Restructured
Restructures a pointer to this type into the target type. Read more
impl<T: ?Sized> Copy for Place<T>
Auto Trait Implementations§
impl<T> Freeze for Place<T>where
T: ?Sized,
impl<T> RefUnwindSafe for Place<T>where
T: RefUnwindSafe + ?Sized,
impl<T> !Send for Place<T>
impl<T> !Sync for Place<T>
impl<T> Unpin for Place<T>where
T: ?Sized,
impl<T> UnwindSafe for Place<T>where
T: RefUnwindSafe + ?Sized,
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out
indicating that a T
is niched.