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<(), Error>,
pub unshare: unsafe fn(&mut ValuePayload) -> *mut (),
}Expand description
Value-model re-exports: the word, its payload, type descriptors, and the
export hook live in crate::value, the single representation for
every type.
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<'_>) -> Result<(), Error>Trait Implementations§
Source§impl Clone for TypeDescriptor
impl Clone for TypeDescriptor
Source§fn clone(&self) -> TypeDescriptor
fn clone(&self) -> TypeDescriptor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more