pub fn pprint<T: Debug>(x: T) -> StringExpand description
Pretty prit a value to a string
This is the main entry point for non-debuging use. For Debugging, see the
crate::dbg macro.
Note that this takes ownership of x, but becasuse impl<T: + Debug> Debug for &T, you can still borrow.
Eg:
ⓘ
use debug3::pprint;
let mut x = vec![1, 2, 3];
assert_eq!(pprint(x), "[1, 2, 3]");
x.push(4);
assert_eq!(pprint(x), "[1, 2, 3, 4]");should be:
use debug3::pprint;
let mut x = vec![1, 2, 3];
assert_eq!(pprint(&x), "[1, 2, 3]");
x.push(4);
assert_eq!(pprint(&x), "[1, 2, 3, 4]");§Examples
use debug3::pprint;
let x = vec![1, 2, 3];
assert_eq!(pprint(x), "[1, 2, 3]");
let y = vec![vec![1, 2, 3], vec![4, 5, 6], vec![7, 8, 9], vec![10, 11, 12], vec![13, 14, 15], vec![16, 17, 18], vec![19, 20, 21], vec![21, 22, 23]];
assert_eq!(pprint(y), "\
[
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
[10, 11, 12],
[13, 14, 15],
[16, 17, 18],
[19, 20, 21],
[21, 22, 23],
]"
);