pub trait Ellipse {
type Output;
// Required method
fn truncate_ellipse_with(&self, len: usize, ellipse: &str) -> Self::Output;
// Provided method
fn truncate_ellipse(&self, len: usize) -> Self::Output { ... }
}
Expand description
Truncate and ellipse strings in a human-friendly way.
§Example
use ellipse::Ellipse;
let input = "🇩🇪🇬🇧🇮🇹🇫🇷";
assert_eq!(&input.truncate_ellipse(2), "🇩🇪🇬🇧...");
Required Associated Types§
Required Methods§
Sourcefn truncate_ellipse_with(&self, len: usize, ellipse: &str) -> Self::Output
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.
Provided Methods§
Sourcefn truncate_ellipse(&self, len: usize) -> Self::Output
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.