Skip to main content

TruncatedDisplay

Trait TruncatedDisplay 

Source
pub trait TruncatedDisplay {
    // Required method
    fn truncated_display(&self, max_length: usize) -> impl Debug + Display;
}
Expand description

Auto-truncate objects at a given length for displaying

Required Methods§

Source

fn truncated_display(&self, max_length: usize) -> impl Debug + Display

Display self with at most max_length chars, including a trailing ‘…’ in case of truncation.

The returned object implements both Debug and Display, depending on how you want to display.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl TruncatedDisplay for &str

Source§

fn truncated_display(&self, max_length: usize) -> impl Debug + Display

Source§

impl TruncatedDisplay for String

Source§

fn truncated_display(&self, max_length: usize) -> impl Debug + Display

Implementors§