Skip to content

Extension for slices to truncate debug output to a set limit of items

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

thepacketgeek/truncate-slice-debug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Extension for slices to truncate debug output to a set limit of items

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages