pub enum AsInitialized {}Expand description
The byte ranges initialized in T are also initialized in the referent of a
Ptr<T>.
Formally: uninitialized bytes may only be present in Ptr<T>’s referent
where they are guaranteed to be present in T. This is a dynamic property:
if, at a particular byte offset, a valid enum discriminant is set, the
subsequent bytes may only have uninitialized bytes as specified by the
corresponding enum.
Formally, given len = size_of_val_raw(ptr), at every byte offset, b, in
the range [0, len):
-
If, in any instance
t: Tof lengthlen, the byte at offsetbintis initialized, then the byte at offsetbwithin*ptrmust be initialized. -
Let
cbe the contents of the byte range[0, b)in*ptr. LetSbe the subset of valid instances ofTof lengthlenwhich containcin the offset range[0, b). If, in any instance oft: TinS, the byte at offsetbintis initialized, then the byte at offsetbin*ptrmust be initialized.Pragmatically, this means that if
*ptris guaranteed to contain an enum type at a particular offset, and the enum discriminant stored in*ptrcorresponds to a valid variant of that enum type, then it is guaranteed that the appropriate bytes of*ptrare initialized as defined by that variant’s bit validity (although note that the variant may contain another enum type, in which case the same rules apply depending on the state of its discriminant, and so on recursively).
Trait Implementations§
impl Validity for AsInitialized
Auto Trait Implementations§
impl Freeze for AsInitialized
impl RefUnwindSafe for AsInitialized
impl Send for AsInitialized
impl Sync for AsInitialized
impl Unpin for AsInitialized
impl UnwindSafe for AsInitialized
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
Source§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)] const SIZE: usize = _
#[doc(hidden)] const SIZE: usize = _
sized_type_properties)Source§#[doc(hidden)] const ALIGN: usize = _
#[doc(hidden)] const ALIGN: usize = _
sized_type_properties)Source§#[doc(hidden)] const IS_ZST: bool = _
#[doc(hidden)] const IS_ZST: bool = _
sized_type_properties)Source§#[doc(hidden)] const LAYOUT: Layout = _
#[doc(hidden)] const LAYOUT: Layout = _
sized_type_properties)Source§#[doc(hidden)] const MAX_SLICE_LEN: usize = _
#[doc(hidden)] const MAX_SLICE_LEN: usize = _
sized_type_properties)[Self]. Read more