[][src]Trait ellipse::Ellipse

pub trait Ellipse {
type Output;
    fn truncate_ellipse_with(&self, len: usize, ellipse: &str) -> Self::Output;

    fn truncate_ellipse(&self, len: usize) -> Self::Output { ... }
}

Truncate and ellipse strings in a human-friendly way.

Example

use ellipse::Ellipse;

let input = "🇩🇪🇬🇧🇮🇹🇫🇷";
assert_eq!(&input.truncate_ellipse(2), "🇩🇪🇬🇧...");

Associated Types

type Output

Loading content...

Required methods

fn truncate_ellipse_with(&self, len: usize, ellipse: &str) -> Self::Output

Truncate to a length of len extended grapheme clusters and place the given ellipse string at the end when truncating.

Truncating to a length of 0 will yield the empty element without an attached ellipsis.

Loading content...

Provided methods

fn truncate_ellipse(&self, len: usize) -> Self::Output

Truncate to a length of len extended grapheme clusters and add ... at the end of the string when truncating.

Truncating to a length of 0 will yield the empty element without an attached ellipsis.

Loading content...

Implementations on Foreign Types

impl<'a> Ellipse for &'a str[src]

type Output = Cow<'a, str>

fn truncate_ellipse(&self, len: usize) -> Self::Output[src]

Loading content...

Implementors

Loading content...