Skip to main content

ByteRangeExt

Trait ByteRangeExt 

Source
pub trait ByteRangeExt {
    // Required methods
    fn full(text: &str) -> Self;
    fn as_usize(&self) -> Range<usize> ⓘ;
    fn slice<'s>(&self, text: &'s str) -> &'s str;
}
Expand description

Extension methods for a ByteRange.

Required Methods§

Source

fn full(text: &str) -> Self

The full byte range covering text, i.e. 0..text.len().

Source

fn as_usize(&self) -> Range<usize> ⓘ

The start..end byte range as plain usize, for slicing a str.

Source

fn slice<'s>(&self, text: &'s str) -> &'s str

Slice the given string by this byte range.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§