Trait devela::mem::Mem

source ·
pub trait Mem {
    const NEEDS_DROP: bool = _;

    // Provided methods
    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 { ... }
    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

A 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 = _

Whether dropping values of this type matters.

Provided Methods§

source

fn mem_needs_drop(&self) -> bool

Returns true if dropping values of this type matters.

source

fn mem_drop(self)
where Self: Sized,

Drops self by running its destructor.

source

fn mem_forget(self)
where Self: Sized,

Forgets about self without running its destructor.

source

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

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

source

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

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

source

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

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

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].

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].

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T: ?Sized> Mem for T