Enum utf8_ranges::Utf8Sequence [] [src]

pub enum Utf8Sequence {
    One(Utf8Range),
    Two([Utf8Range; 2]),
    Three([Utf8Range; 3]),
    Four([Utf8Range; 4]),
}

Utf8Sequence represents a sequence of byte ranges.

To match a Utf8Sequence, a candidate byte sequence must match each successive range.

For example, if there are two ranges, [C2-DF][80-BF], then the byte sequence \xDD\x61 would not match because 0x61 < 0x80.

Variants

One

One byte range.

Two

Two successive byte ranges.

Three

Three successive byte ranges.

Four

Four successive byte ranges.

Methods

impl Utf8Sequence

fn as_slice(&self) -> &[Utf8Range]

Returns the underlying sequence of byte ranges as a slice.

fn len(&self) -> usize

Returns the number of byte ranges in this sequence.

The length is guaranteed to be in the closed interval [1, 4].

fn matches(&self, bytes: &[u8]) -> bool

Returns true if and only if a prefix of bytes matches this sequence of byte ranges.

Trait Implementations

impl<'a> IntoIterator for &'a Utf8Sequence

type IntoIter = Iter<'a, Utf8Range>

type Item = &'a Utf8Range

fn into_iter(self) -> Self::IntoIter

impl Debug for Utf8Sequence

fn fmt(&self, f: &mut Formatter) -> Result

Derived Implementations

impl PartialEq for Utf8Sequence

fn eq(&self, __arg_0: &Utf8Sequence) -> bool

fn ne(&self, __arg_0: &Utf8Sequence) -> bool

impl Eq for Utf8Sequence

impl Clone for Utf8Sequence

fn clone(&self) -> Utf8Sequence

fn clone_from(&mut self, source: &Self)

impl Copy for Utf8Sequence