pub struct TypeDescriptor {
pub name: &'static str,
pub summary: &'static str,
pub docs: &'static str,
pub clone: unsafe fn(ValuePayload) -> ValuePayload,
pub drop: unsafe fn(ValuePayload),
pub eq: unsafe fn(ValuePayload, ValuePayload) -> bool,
pub fmt: unsafe fn(ValuePayload, &mut Formatter<'_>) -> Result,
pub unshare: unsafe fn(&mut ValuePayload) -> *mut (),
}Expand description
Vtable for one type: lifecycle plus operations. All hooks are plain
function pointers (never closures) so descriptors stay Copy and the
global table hands them out by value. Every hook documents the payload
domain it expects; calling one with a foreign payload is unsound, and
every call site is a single choke point reviewed with the layout.
unshare is the copy-on-write gate: it rewrites the payload to a
uniquely owned buffer when necessary and returns a mutable pointer the
caller exclusively owns. Mutation must always go through
Value::read_heap_mut; deriving &mut from a payload any other way
is unsound for shared heaps.
Fields§
§name: &'static str§summary: &'static str§docs: &'static str§clone: unsafe fn(ValuePayload) -> ValuePayload§drop: unsafe fn(ValuePayload)§eq: unsafe fn(ValuePayload, ValuePayload) -> bool§fmt: unsafe fn(ValuePayload, &mut Formatter<'_>) -> ResultTrait Implementations§
Source§impl Clone for TypeDescriptor
impl Clone for TypeDescriptor
Source§fn clone(&self) -> TypeDescriptor
fn clone(&self) -> TypeDescriptor
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for TypeDescriptor
Auto Trait Implementations§
impl Freeze for TypeDescriptor
impl RefUnwindSafe for TypeDescriptor
impl Send for TypeDescriptor
impl Sync for TypeDescriptor
impl Unpin for TypeDescriptor
impl UnsafeUnpin for TypeDescriptor
impl UnwindSafe for TypeDescriptor
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