Trait MemDbg

Source
pub trait MemDbg: MemDbgImpl {
    // Provided methods
    fn mem_dbg(&self, flags: DbgFlags) -> Result { ... }
    fn mem_dbg_on(&self, writer: &mut impl Write, flags: DbgFlags) -> Result { ... }
    fn mem_dbg_depth(&self, max_depth: usize, flags: DbgFlags) -> Result { ... }
    fn mem_dbg_depth_on(
        &self,
        writer: &mut impl Write,
        max_depth: usize,
        flags: DbgFlags,
    ) -> Result { ... }
}
Expand description

A trait providing methods to display recursively the content and size of a structure.

You can derive this trait with #[derive(MemDbg)] if all the fields of your type implement MemDbg. Note that you will also need to derive MemSize.

Provided Methods§

Source

fn mem_dbg(&self, flags: DbgFlags) -> Result

Writes to stderr debug infos about the structure memory usage, expanding all levels of nested structures.

Source

fn mem_dbg_on(&self, writer: &mut impl Write, flags: DbgFlags) -> Result

Writes to a core::fmt::Write debug infos about the structure memory usage, expanding all levels of nested structures.

Source

fn mem_dbg_depth(&self, max_depth: usize, flags: DbgFlags) -> Result

Writes to stderr debug infos about the structure memory usage as mem_dbg, but expanding only up to max_depth levels of nested structures.

Source

fn mem_dbg_depth_on( &self, writer: &mut impl Write, max_depth: usize, flags: DbgFlags, ) -> Result

Writes to a core::fmt::Write debug infos about the structure memory usage as mem_dbg_on, but expanding only up to max_depth levels of nested structures.

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: MemDbgImpl> MemDbg for T

Implemens MemDbg for all types that implement MemDbgImpl.

This is done so that no one can change the implementation of MemDbg, which ensures consistency in printing.