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 moreimpl Copy for TypeDescriptor
Auto Trait Implementations§
impl Forget for TypeDescriptor
impl Freeze for TypeDescriptor
impl Move for TypeDescriptor
impl RefUnwindSafe for TypeDescriptor
impl Send for TypeDescriptor
impl Sync for TypeDescriptor
impl Unpin for TypeDescriptor
impl UnsafeUnpin for TypeDescriptorwhere
&'static str: UnsafeUnpin,
impl UnwindSafe for TypeDescriptorwhere
&'static str: UnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.