pub struct DebugStruct<'a> { /* private fields */ }
Expand description

A helper designed to assist with creation of DebugPls implementations for structs.

Examples

use dbg_pls::{pretty, DebugPls, Formatter};

struct Foo {
    bar: i32,
    baz: String,
}

impl DebugPls for Foo {
    fn fmt(&self, f: Formatter) {
        f.debug_struct("Foo")
            .field("bar", &self.bar)
            .field("baz", &self.baz)
            .finish()
    }
}
let value = Foo {
    bar: 10,
    baz: "Hello World".to_string(),
};
assert_eq!(
    format!("{}", pretty(&value)),
    "Foo { bar: 10, baz: \"Hello World\" }",
);

Implementations

Adds the field to the struct output.

Closes off the struct.

Closes off the struct with ...

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.