truncate-slice-debug 0.1.1

Extension for slices to truncate debug output to a set limit of items
Documentation
  • Coverage
  • 40%
    2 out of 5 items documented1 out of 5 items with examples
  • Size
  • Source code size: 15.47 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.34 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • thepacketgeek/truncate-slice-debug
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • thepacketgeek

truncate-slice-debug

A helper trait to truncate slice Debug output to a provided limit of items.

Example Usage

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]");
}

License

truncate-slice-debug is both MIT and Apache License, Version 2.0 licensed, as found in the LICENSE-MIT and LICENSE-APACHE files.