devela::all

Trait ExtMem

Source
pub trait ExtMem {
    const NEEDS_DROP: bool = _;
Show 15 methods // Provided methods fn mem_align_of<T>() -> usize { ... } fn mem_align_of_val(&self) -> usize { ... } fn mem_size_of<T>() -> usize { ... } fn mem_size_of_val(&self) -> usize { ... } fn mem_copy(&self) -> Self where Self: Copy { ... } fn mem_needs_drop(&self) -> bool { ... } fn mem_drop(self) where Self: Sized { ... } fn mem_forget(self) where Self: Sized { ... } fn mem_replace(&mut self, other: Self) -> Self where Self: Sized { ... } fn mem_take(&mut self) -> Self where Self: Default { ... } fn mem_swap(&mut self, other: &mut Self) where Self: Sized { ... } unsafe fn mem_zeroed<T>() -> T { ... } unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst { ... } fn mem_as_bytes(&self) -> &[u8] where Self: Sync + Unpin { ... } fn mem_as_bytes_mut(&mut self) -> &mut [u8] where Self: Sync + Unpin { ... }
}
Expand description

Extension trait for type memory information and manipulation.

This trait is automatically implemented for every ?Sized type, although most methods are only available where Self: Sized.

Provided Associated Constants§

Source

const NEEDS_DROP: bool = _

Know whether dropping values of this type matters, in compile-time.

Provided Methods§

Source

fn mem_align_of<T>() -> usize

Returns the minimum alignment of the type in bytes.

See Mem::align_of.

Source

fn mem_align_of_val(&self) -> usize

Returns the alignment of the pointed-to value in bytes.

See Mem::align_of_val.

Source

fn mem_size_of<T>() -> usize

Returns the size of a type in bytes.

See Mem::size_of.

Source

fn mem_size_of_val(&self) -> usize

Returns the size of the pointed-to value in bytes.

See Mem::size_of_val.

Source

fn mem_copy(&self) -> Self
where Self: Copy,

Bitwise-copies a value.

It is useful when you want to pass a function pointer to a combinator, rather than defining a new closure.

See Mem::copy.

Source

fn mem_needs_drop(&self) -> bool

Returns true if dropping values of this type matters.

See Mem::needs_drop.

Source

fn mem_drop(self)
where Self: Sized,

Drops self by running its destructor.

See Mem::drop.

Source

fn mem_forget(self)
where Self: Sized,

Forgets about self without running its destructor.

See Mem::forget.

Source

fn mem_replace(&mut self, other: Self) -> Self
where Self: Sized,

Replaces self with other, returning the previous value of self.

See Mem::replace.

Source

fn mem_take(&mut self) -> Self
where Self: Default,

Replaces self with its default value, returning the previous value of self.

See Mem::take.

Source

fn mem_swap(&mut self, other: &mut Self)
where Self: Sized,

Swaps the value of self and other without deinitializing either one.

See Mem::swap.

Source

unsafe fn mem_zeroed<T>() -> T

Available on crate feature unsafe_layout only.

Returns the value of type T represented by the all-zero byte-pattern.

§Safety

See Mem::zeroed.

Source

unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst

Available on crate feature unsafe_layout only.

Returns the value of type T represented by the all-zero byte-pattern.

§Safety

See Mem::transmute_copy.

Source

fn mem_as_bytes(&self) -> &[u8]
where Self: Sync + Unpin,

Available on crate feature unsafe_slice only.

View a Sync + Unpin self as &[u8].

See Mem::as_bytes, and for the const version for sized types see Mem::as_bytes_sized.

Source

fn mem_as_bytes_mut(&mut self) -> &mut [u8]
where Self: Sync + Unpin,

Available on crate feature unsafe_slice only.

View a Sync + Unpin self as &mut [u8].

See Mem::as_bytes_mut.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T: ?Sized> ExtMem for T