Skip to main content

ByteRange

Type Alias ByteRange 

Source
pub type ByteRange = Range<ByteIndex>;
Expand description

A range of ByteIndex, i.e. a byte range into a str.

Aliased Type§

pub struct ByteRange {
    pub start: ByteIndex,
    pub end: ByteIndex,
}

Fields§

§start: ByteIndex

The lower bound of the range (inclusive).

§end: ByteIndex

The upper bound of the range (exclusive).

Trait Implementations§

Source§

impl ByteRangeExt for ByteRange

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.