Struct regex_syntax::utf8::ScalarRange

source ·
struct ScalarRange {
    start: u32,
    end: u32,
}

Fields§

§start: u32§end: u32

Implementations§

source§

impl ScalarRange

source

fn split(&self) -> Option<(ScalarRange, ScalarRange)>

split splits this range if it overlaps with a surrogate codepoint.

Either or both ranges may be invalid.

source

fn is_valid(&self) -> bool

is_valid returns true if and only if start <= end.

source

fn as_ascii(&self) -> Option<Utf8Range>

as_ascii returns this range as a Utf8Range if and only if all scalar values in this range can be encoded as a single byte.

source

fn is_ascii(&self) -> bool

is_ascii returns true if the range is ASCII only (i.e., takes a single byte to encode any scalar value).

source

fn encode(&self, start: &mut [u8], end: &mut [u8]) -> usize

encode writes the UTF-8 encoding of the start and end of this range to the corresponding destination slices, and returns the number of bytes written.

The slices should have room for at least MAX_UTF8_BYTES.

Trait Implementations§

source§

impl Debug for ScalarRange

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.