pub struct RawLateFieldDescriptor { /* private fields */ }Expand description
A raw (untyped) descriptor for a LateField.
You can obtain a reference to this descriptor using LateField::raw_descriptor.
Unlike LateFieldDescriptor, the type of the LateStruct to which this descriptor belongs
is erased. There is no descriptor which also specifies the type of the LateField since it
would be redundant.
Implementations§
Source§impl RawLateFieldDescriptor
impl RawLateFieldDescriptor
Sourcepub fn parent_struct(&self) -> &'static RawLateStructDescriptor
pub fn parent_struct(&self) -> &'static RawLateStructDescriptor
Fetches the descriptor of the struct to which this field belongs.
Sourcepub fn index(&self, token: LateLayoutInitToken) -> usize
pub fn index(&self, token: LateLayoutInitToken) -> usize
Fetches the index of the field within the RawLateStructDescriptor::fields list of the struct to which this field belongs. The ordering of these indices is not stable across compilations.
Sourcepub fn offset(&self, token: LateLayoutInitToken) -> usize
pub fn offset(&self, token: LateLayoutInitToken) -> usize
Fetches the offset of this field’s value within the overall struct.
Sourcepub unsafe fn drop(&self, value: *mut u8)
pub unsafe fn drop(&self, value: *mut u8)
Drops the instance of the field’s value pointed to by value.
§Safety
value must point to an initialized instance of the field’s value.
Sourcepub unsafe fn erase_value<S: LateStruct>(
&self,
value: *mut u8,
) -> *mut S::EraseTo
pub unsafe fn erase_value<S: LateStruct>( &self, value: *mut u8, ) -> *mut S::EraseTo
Adorns an untyped pointer in memory with the metadata required to become a pointer to
the specified LateStruct’s S::EraseTo type.
value need not point to a valid location in memory.
This operation can be performed safely by converting this descriptor into a
LateFieldDescriptor using the RawLateFieldDescriptor::typed method and calling its
LateFieldDescriptor::erase_value method.
§Safety
S must match the type of the LateStruct marker this descriptor is describing.
Sourcepub fn key_type_name(&self) -> &'static str
pub fn key_type_name(&self) -> &'static str
Sourcepub fn key_type_id(&self) -> TypeId
pub fn key_type_id(&self) -> TypeId
Sourcepub fn typed<S: LateStruct>(&self) -> &LateFieldDescriptor<S>
pub fn typed<S: LateStruct>(&self) -> &LateFieldDescriptor<S>
Downcasts the descriptor to a typed LateFieldDescriptor instance.
S must match the type of the LateStruct marker to which this descriptor belongs or the
method will panic.
Sourcepub unsafe fn typed_unchecked<S: LateStruct>(&self) -> &LateFieldDescriptor<S>
pub unsafe fn typed_unchecked<S: LateStruct>(&self) -> &LateFieldDescriptor<S>
Downcasts the descriptor to a typed LateFieldDescriptor instance.
This operation can be safely performed with RawLateFieldDescriptor::typed.
§Safety
S must match the type of the LateStruct marker to which this descriptor belongs.
Failing to do so will not cause immediate undefined behavior but could cause latent
undefined behavior if passed to a method expecting the descriptor to belong to a certain
LateStruct type.