#[repr(C)]pub struct ValueVTable {Show 16 fields
pub type_name: fn(&mut Formatter<'_>, TypeNameOpts) -> Result<(), Error>,
pub marker_traits: MarkerTraits,
pub drop_in_place: Option<for<'mem> unsafe fn(PtrMut<'mem>) -> PtrUninit<'mem>>,
pub invariants: Option<for<'mem> unsafe fn(PtrConst<'mem>) -> bool>,
pub display: Option<for<'mem> unsafe fn(PtrConst<'mem>, &mut Formatter<'_>) -> Result<(), Error>>,
pub debug: Option<for<'mem> unsafe fn(PtrConst<'mem>, &mut Formatter<'_>) -> Result<(), Error>>,
pub default_in_place: Option<for<'mem> unsafe fn(PtrUninit<'mem>) -> PtrMut<'mem>>,
pub clone_into: Option<for<'src, 'dst> unsafe fn(PtrConst<'src>, PtrUninit<'dst>) -> PtrMut<'dst>>,
pub partial_eq: Option<for<'l, 'r> unsafe fn(PtrConst<'l>, PtrConst<'r>) -> bool>,
pub partial_ord: Option<for<'l, 'r> unsafe fn(PtrConst<'l>, PtrConst<'r>) -> Option<Ordering>>,
pub ord: Option<for<'l, 'r> unsafe fn(PtrConst<'l>, PtrConst<'r>) -> Ordering>,
pub hash: Option<for<'mem> unsafe fn(PtrConst<'mem>, &mut dyn Hasher)>,
pub parse: Option<for<'mem> unsafe fn(&str, PtrUninit<'mem>) -> Result<PtrMut<'mem>, ParseError>>,
pub try_from: Option<for<'src, 'mem, 'shape> unsafe fn(PtrConst<'src>, &'static Shape, PtrUninit<'mem>) -> Result<PtrMut<'mem>, TryFromError>>,
pub try_into_inner: Option<for<'src, 'dst> unsafe fn(PtrMut<'src>, PtrUninit<'dst>) -> Result<PtrMut<'dst>, TryIntoInnerError>>,
pub try_borrow_inner: Option<for<'src> unsafe fn(PtrConst<'src>) -> Result<PtrConst<'src>, TryBorrowInnerError>>,
}Expand description
A vtable representing the operations that can be performed on a type, either for sized or unsized types.
This enum encapsulates the specific vtables allowing generic type-agnostic dynamic dispatch for core capabilities (clone, drop, compare, hash, etc).
Fields§
§type_name: fn(&mut Formatter<'_>, TypeNameOpts) -> Result<(), Error>cf. TypeNameFn
marker_traits: MarkerTraitsMarker traits implemented by the type
drop_in_place: Option<for<'mem> unsafe fn(PtrMut<'mem>) -> PtrUninit<'mem>>cf. DropInPlaceFn — if None, drops without side-effects
invariants: Option<for<'mem> unsafe fn(PtrConst<'mem>) -> bool>cf. InvariantsFn
display: Option<for<'mem> unsafe fn(PtrConst<'mem>, &mut Formatter<'_>) -> Result<(), Error>>cf. DisplayFn
debug: Option<for<'mem> unsafe fn(PtrConst<'mem>, &mut Formatter<'_>) -> Result<(), Error>>cf. DebugFn
default_in_place: Option<for<'mem> unsafe fn(PtrUninit<'mem>) -> PtrMut<'mem>>cf. DefaultInPlaceFn
clone_into: Option<for<'src, 'dst> unsafe fn(PtrConst<'src>, PtrUninit<'dst>) -> PtrMut<'dst>>cf. CloneIntoFn
partial_eq: Option<for<'l, 'r> unsafe fn(PtrConst<'l>, PtrConst<'r>) -> bool>cf. PartialEqFn for equality comparison
partial_ord: Option<for<'l, 'r> unsafe fn(PtrConst<'l>, PtrConst<'r>) -> Option<Ordering>>cf. PartialOrdFn for partial ordering comparison
ord: Option<for<'l, 'r> unsafe fn(PtrConst<'l>, PtrConst<'r>) -> Ordering>cf. CmpFn for total ordering
hash: Option<for<'mem> unsafe fn(PtrConst<'mem>, &mut dyn Hasher)>cf. HashFn
parse: Option<for<'mem> unsafe fn(&str, PtrUninit<'mem>) -> Result<PtrMut<'mem>, ParseError>>cf. ParseFn
try_from: Option<for<'src, 'mem, 'shape> unsafe fn(PtrConst<'src>, &'static Shape, PtrUninit<'mem>) -> Result<PtrMut<'mem>, TryFromError>>cf. TryFromFn
This also acts as a “TryFromInner” — you can use it to go:
String=>Utf8PathBufString=>UuidT=>Option<T>T=>Arc<T>T=>NonZero<T>- etc.
try_into_inner: Option<for<'src, 'dst> unsafe fn(PtrMut<'src>, PtrUninit<'dst>) -> Result<PtrMut<'dst>, TryIntoInnerError>>cf. TryIntoInnerFn
This is used by transparent types to convert the wrapper type into its inner value. Primarily used during serialization.
try_borrow_inner: Option<for<'src> unsafe fn(PtrConst<'src>) -> Result<PtrConst<'src>, TryBorrowInnerError>>cf. TryBorrowInnerFn
This is used by transparent types to efficiently access the inner value without copying.
Implementations§
Source§impl ValueVTable
impl ValueVTable
Sourcepub const fn marker_traits(&self) -> MarkerTraits
pub const fn marker_traits(&self) -> MarkerTraits
Get the marker traits implemented for the type
Sourcepub const fn type_name(
&self,
) -> fn(&mut Formatter<'_>, TypeNameOpts) -> Result<(), Error>
pub const fn type_name( &self, ) -> fn(&mut Formatter<'_>, TypeNameOpts) -> Result<(), Error>
Get the type name fn of the type
Sourcepub const fn is_unwind_safe(&self) -> bool
pub const fn is_unwind_safe(&self) -> bool
Check if the type implements the UnwindSafe marker trait
Sourcepub const fn is_ref_unwind_safe(&self) -> bool
pub const fn is_ref_unwind_safe(&self) -> bool
Check if the type implements the RefUnwindSafe marker trait
Sourcepub const fn has_display(&self) -> bool
pub const fn has_display(&self) -> bool
Returns true if the type implements the Display trait and the display function is available in the vtable.
Sourcepub const fn has_debug(&self) -> bool
pub const fn has_debug(&self) -> bool
Returns true if the type implements the Debug trait and the debug function is available in the vtable.
Sourcepub const fn has_partial_eq(&self) -> bool
pub const fn has_partial_eq(&self) -> bool
Returns true if the type implements the PartialEq trait and the partial_eq function is available in the vtable.
Sourcepub const fn has_partial_ord(&self) -> bool
pub const fn has_partial_ord(&self) -> bool
Returns true if the type implements the PartialOrd trait and the partial_ord function is available in the vtable.
Sourcepub const fn has_ord(&self) -> bool
pub const fn has_ord(&self) -> bool
Returns true if the type implements the Ord trait and the ord function is available in the vtable.
Sourcepub const fn has_hash(&self) -> bool
pub const fn has_hash(&self) -> bool
Returns true if the type implements the Hash trait and the hash function is available in the vtable.
Sourcepub const fn has_default_in_place(&self) -> bool
pub const fn has_default_in_place(&self) -> bool
Returns true if the type supports default-in-place construction via the vtable.
Sourcepub const fn has_clone_into(&self) -> bool
pub const fn has_clone_into(&self) -> bool
Returns true if the type supports in-place cloning via the vtable.
Sourcepub const fn has_parse(&self) -> bool
pub const fn has_parse(&self) -> bool
Returns true if the type supports parsing from a string via the vtable.
Sourcepub const fn builder<T>() -> ValueVTableBuilder<T>where
T: ?Sized,
pub const fn builder<T>() -> ValueVTableBuilder<T>where
T: ?Sized,
Creates a new ValueVTableBuilder
Trait Implementations§
Source§impl Clone for ValueVTable
impl Clone for ValueVTable
Source§fn clone(&self) -> ValueVTable
fn clone(&self) -> ValueVTable
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more