pub trait DisplaySliceExt<'a, T: Display> {
// Required method
fn display(&'a self) -> DisplaySlice<'a, T>;
// Provided method
fn display_n(&'a self, n: usize) -> DisplaySlice<'a, T> { ... }
}Expand description
Implement Display for &[T] if T is Display.
It outputs at most MAX elements, excluding those from the 5th to the second-to-last one:
DisplaySlice(&[1,2,3,4,5,6])outputs:"[1,2,3,4,...,6]".
§Example
use display_more::DisplaySliceExt;
let a = vec![1, 2, 3, 4, 5, 6];
assert_eq!(a.display().to_string(), "[1,2,3,4,..,6]");Required Methods§
fn display(&'a self) -> DisplaySlice<'a, T>
Provided Methods§
Sourcefn display_n(&'a self, n: usize) -> DisplaySlice<'a, T>
fn display_n(&'a self, n: usize) -> DisplaySlice<'a, T>
Display at most n elements.