Skip to main content

DepthPrinter

Struct DepthPrinter 

Source
pub struct DepthPrinter<W: Write> { /* private fields */ }
Expand description

Helper for printing ‘dump’ style information at different depths (i.e. with space prefixes).

This type is not thread safe.

Implementations§

Source§

impl<W: Write> DepthPrinter<W>

Source

pub fn new(writer: W, depth: usize) -> Self

Creates a printer emitting items at depth to writer.

Source

pub fn emit(&mut self, args: Arguments<'_>)

Emit a single item. It will have spaces prefixed based on the depth and a newline added to the end.

Use the emit! macro to construct the [core::fmt::Arguments] and emit an item in one step.

Source

pub fn begin_list(&mut self, max: usize)

Indicates a list is about to be emitted. Only at most max emit calls will result in output, with any additional being counted. DepthPrinter::end_list must be called once finished emitting the list.

Source

pub fn end_list(&mut self)

Indicates that printing of the list is finished and, if relevant, will emit a message indicating how many items were skipped.

Source§

impl DepthPrinter<ConsoleSink>

Source

pub fn console(depth: usize) -> Self

Creates a printer emitting items at depth to the kernel console.

Trait Implementations§

Source§

impl<W: Write> Drop for DepthPrinter<W>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<W> Freeze for DepthPrinter<W>
where W: Freeze,

§

impl<W> RefUnwindSafe for DepthPrinter<W>
where W: RefUnwindSafe,

§

impl<W> Send for DepthPrinter<W>
where W: Send,

§

impl<W> Sync for DepthPrinter<W>
where W: Sync,

§

impl<W> Unpin for DepthPrinter<W>
where W: Unpin,

§

impl<W> UnsafeUnpin for DepthPrinter<W>
where W: UnsafeUnpin,

§

impl<W> UnwindSafe for DepthPrinter<W>
where W: UnwindSafe,

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Init<T> for T

§

unsafe fn __init(self, slot: *mut T) -> Result<(), !>

Initializes slot. Read more
§

fn chain<F>(self, f: F) -> ChainInit<Self, F, T, E>
where F: FnOnce(&mut T) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T> PinInit<T> for T

§

unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), !>

Initializes slot. Read more
§

fn pin_chain<F>(self, f: F) -> ChainPinInit<Self, F, T, E>
where F: FnOnce(Pin<&mut T>) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
§

impl<T> ToMutPtr for T
where T: ?Sized,

§

type Target = T

The target type of the pointer.
§

fn to_mut_ptr(&self) -> *mut T

Casts the reference to a mutable raw pointer.
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = !

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.