Crates.io | truncate-slice-debug |
lib.rs | truncate-slice-debug |
version | 0.1.1 |
source | src |
created_at | 2022-08-10 22:06:29.304849 |
updated_at | 2022-10-05 18:19:40.333167 |
description | Extension for slices to truncate debug output to a set limit of items |
homepage | https://github.com/thepacketgeek/truncate-slice-debug |
repository | https://github.com/thepacketgeek/truncate-slice-debug |
max_upload_size | |
id | 642929 |
size | 15,780 |
A helper trait to truncate slice Debug
output to a provided limit of items.
use truncate_slice_debug::TruncateSliceDebug;
fn main() {
let values = vec![0, 1, 2, 3, 4, 5];
let dbg_output = format!("{:?}", values.as_slice().truncate_debug(3));
assert_eq!(&dbg_output, "[0, 1, 2, ...(3 more)]");
let dbg_output = format!("{:?}", values.as_slice().truncate_debug(10));
assert_eq!(&dbg_output, "[0, 1, 2, 3, 4, 5]");
}
truncate-slice-debug
is both MIT and Apache License, Version 2.0 licensed, as found
in the LICENSE-MIT and LICENSE-APACHE files.