Struct dbg_pls::DebugStruct
source · [−]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
sourceimpl<'a> DebugStruct<'a>
impl<'a> DebugStruct<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for DebugStruct<'a>
impl<'a> !Send for DebugStruct<'a>
impl<'a> !Sync for DebugStruct<'a>
impl<'a> Unpin for DebugStruct<'a>
impl<'a> !UnwindSafe for DebugStruct<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more