pub struct TruncateWith<T> { /* private fields */ }Expand description
Truncates with a tail indicator (e.g., “…”).
max_chars is the total output budget including the tail. If the inner content
fits within the budget, it passes through unchanged (no tail shown). If it exceeds
the budget, inner content is truncated at max_chars - tail_chars and the tail is
appended. Total output is always <= max_chars.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for TruncateWith<T>where
T: Freeze,
impl<T> RefUnwindSafe for TruncateWith<T>where
T: RefUnwindSafe,
impl<T> Send for TruncateWith<T>where
T: Send,
impl<T> Sync for TruncateWith<T>where
T: Sync,
impl<T> Unpin for TruncateWith<T>where
T: Unpin,
impl<T> UnsafeUnpin for TruncateWith<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for TruncateWith<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> DisplayExt for T
impl<T> DisplayExt for T
fn is_empty(&self) -> bool
fn write_to_fmt<W>(&self, writer: W) -> Result<(), Error>where
W: Write,
fn write_to_bytes<W>(&self, writer: W) -> Result<(), Error>where
W: Write,
fn format_with<F>(&self, cb: F) -> Result<(), Error>
fn try_to_fmt<T>(&self) -> Result<T, T>
fn try_to_bytes<T>(&self) -> Result<T, T>
fn to_fmt<T>(&self) -> T
fn to_bytes<T>(&self) -> T
Source§impl<T> SmartFormat for Twhere
T: Display,
impl<T> SmartFormat for Twhere
T: Display,
Source§fn display_wrap<P: Display, S: Display>(
self,
prefix: P,
suffix: S,
) -> Wrap<Self, P, S>
fn display_wrap<P: Display, S: Display>( self, prefix: P, suffix: S, ) -> Wrap<Self, P, S>
Wrap with a prefix and suffix:
prefix + self + suffix.Source§fn display_prefix<P: Display>(self, prefix: P) -> Prefix<Self, P>
fn display_prefix<P: Display>(self, prefix: P) -> Prefix<Self, P>
Prepend a prefix:
prefix + self.Source§fn display_suffix<S: Display>(self, suffix: S) -> Suffix<Self, S>
fn display_suffix<S: Display>(self, suffix: S) -> Suffix<Self, S>
Append a suffix:
self + suffix.Source§fn display_if(self, condition: bool) -> If<Self>
fn display_if(self, condition: bool) -> If<Self>
Conditionally display: if
condition is true, display self; otherwise write nothing.Source§fn display_truncate(self, max_chars: usize) -> Truncate<Self>
fn display_truncate(self, max_chars: usize) -> Truncate<Self>
Truncate to at most
max_chars Unicode scalar values. Read moreSource§fn display_truncate_with(
self,
max_chars: usize,
tail: &'static str,
) -> TruncateWith<Self>
fn display_truncate_with( self, max_chars: usize, tail: &'static str, ) -> TruncateWith<Self>
Truncate with a tail indicator (e.g., “…”). Read more