Skip to main content

TruncatesString

Trait TruncatesString 

Source
pub trait TruncatesString {
    // Required method
    fn truncate_bytes(&self, n: usize) -> &str;
}

Required Methods§

Source

fn truncate_bytes(&self, n: usize) -> &str

Truncates the given string to around n bytes, on the closest UTF-8 code point boundary.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl TruncatesString for &str

Source§

fn truncate_bytes(&self, n: usize) -> &str

Implementors§