Sliceable

Trait Sliceable 

Source
pub trait Sliceable {
    // Required method
    fn slice<R>(&self, range: R) -> Option<Self>
       where R: RangeBounds<usize> + Clone,
             Self: Sized;
}
Expand description

Provides function for slicing a text object on byte index (like str::get)

Required Methods§

Source

fn slice<R>(&self, range: R) -> Option<Self>
where R: RangeBounds<usize> + Clone, Self: Sized,

Slice an underlying text object by bytes.

§Example
use stylish_stringlike::text::Sliceable;
let foo = "foobar";
assert_eq!(foo.get(1..4), foo.slice(1..4));

Implementations on Foreign Types§

Source§

impl Sliceable for String

Source§

fn slice<R>(&self, range: R) -> Option<Self>
where R: RangeBounds<usize> + Clone, Self: Sized,

Source§

impl<'a> Sliceable for &'a str

Source§

fn slice<R>(&self, range: R) -> Option<Self>
where R: RangeBounds<usize> + Clone, Self: Sized,

Implementors§

Source§

impl<'a, T: Clone> Sliceable for Span<'a, T>

Source§

impl<'a, T: Clone> Sliceable for Spans<T>