#[repr(C)]pub struct TypeOpsDirect {
pub drop_in_place: unsafe fn(*mut ()),
pub default_in_place: Option<unsafe fn(*mut ())>,
pub clone_into: Option<unsafe fn(src: *const (), dst: *mut ())>,
pub is_truthy: Option<TruthyFn>,
}Expand description
Type-specific operations for concrete types (uses thin pointers).
Used for scalars, String, user-defined structs/enums, etc.
These operations must be monomorphized per-type because they need to know
the concrete type T at compile time:
drop_in_place: Needs to callT’s destructordefault_in_place: Needs to constructT::default()clone_into: Needs to callT::clone()
Fields§
§drop_in_place: unsafe fn(*mut ())Drop the value in place.
§Safety
The pointer must point to a valid, initialized value of the correct type.
default_in_place: Option<unsafe fn(*mut ())>Construct a default value in place.
Returns None if the type doesn’t implement Default.
§Safety
The pointer must point to uninitialized memory of sufficient size and alignment.
clone_into: Option<unsafe fn(src: *const (), dst: *mut ())>Clone a value into uninitialized memory.
Returns None if the type doesn’t implement Clone.
§Safety
srcmust point to a valid, initialized valuedstmust point to uninitialized memory of sufficient size and alignment
is_truthy: Option<TruthyFn>Truthiness predicate for this type. When absent, the type is never considered truthy.
Trait Implementations§
Source§impl Clone for TypeOpsDirect
impl Clone for TypeOpsDirect
Source§fn clone(&self) -> TypeOpsDirect
fn clone(&self) -> TypeOpsDirect
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TypeOpsDirect
impl Debug for TypeOpsDirect
Source§impl From<&'static TypeOpsDirect> for TypeOps
impl From<&'static TypeOpsDirect> for TypeOps
Source§fn from(ops: &'static TypeOpsDirect) -> Self
fn from(ops: &'static TypeOpsDirect) -> Self
Converts to this type from the input type.
impl Copy for TypeOpsDirect
Auto Trait Implementations§
impl Freeze for TypeOpsDirect
impl RefUnwindSafe for TypeOpsDirect
impl Send for TypeOpsDirect
impl Sync for TypeOpsDirect
impl Unpin for TypeOpsDirect
impl UnwindSafe for TypeOpsDirect
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