Struct ClassBytes
struct ClassBytes { ... }
A set of characters represented by arbitrary bytes.
Each byte corresponds to one character.
Implementations
impl ClassBytes
fn new<I>(ranges: I) -> ClassBytes where I: IntoIterator<Item = ClassBytesRange>Create a new class from a sequence of ranges.
The given ranges do not need to be in any specific order, and ranges may overlap. Ranges will automatically be sorted into a canonical non-overlapping order.
fn empty() -> ClassBytesCreate a new class with no ranges.
An empty class matches nothing. That is, it is equivalent to
Hir::fail.fn push(self: &mut Self, range: ClassBytesRange)Add a new range to this set.
fn iter(self: &Self) -> ClassBytesIter<'_>Return an iterator over all ranges in this class.
The iterator yields ranges in ascending order.
fn ranges(self: &Self) -> &[ClassBytesRange]Return the underlying ranges as a slice.
fn case_fold_simple(self: &mut Self)Expand this character class such that it contains all case folded characters. For example, if this class consists of the range
a-z, then applying case folding will result in the class containing both the rangesa-zandA-Z.Note that this only applies ASCII case folding, which is limited to the characters
a-zandA-Z.fn negate(self: &mut Self)Negate this byte class.
For all
bwherebis a any byte, ifbwas in this set, then it will not be in this set after negation.fn union(self: &mut Self, other: &ClassBytes)Union this byte class with the given byte class, in place.
fn intersect(self: &mut Self, other: &ClassBytes)Intersect this byte class with the given byte class, in place.
fn difference(self: &mut Self, other: &ClassBytes)Subtract the given byte class from this byte class, in place.
fn symmetric_difference(self: &mut Self, other: &ClassBytes)Compute the symmetric difference of the given byte classes, in place.
This computes the symmetric difference of two byte classes. This removes all elements in this class that are also in the given class, but all adds all elements from the given class that aren't in this class. That is, the class will contain all elements in either class, but will not contain any elements that are in both classes.
fn is_ascii(self: &Self) -> boolReturns true if and only if this character class will either match nothing or only ASCII bytes. Stated differently, this returns false if and only if this class contains a non-ASCII byte.
fn minimum_len(self: &Self) -> Option<usize>Returns the length, in bytes, of the smallest string matched by this character class.
Returns
Nonewhen the class is empty.fn maximum_len(self: &Self) -> Option<usize>Returns the length, in bytes, of the longest string matched by this character class.
Returns
Nonewhen the class is empty.fn literal(self: &Self) -> Option<Vec<u8>>If this class consists of exactly one byte, then return it as a literal byte string.
If this class is empty or contains more than one byte, then
Noneis returned.fn to_unicode_class(self: &Self) -> Option<ClassUnicode>If this class consists of only ASCII ranges, then return its corresponding and equivalent Unicode class.
impl Clone for ClassBytes
fn clone(self: &Self) -> ClassBytes
impl Debug for ClassBytes
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Eq for ClassBytes
impl Freeze for ClassBytes
impl PartialEq for ClassBytes
fn eq(self: &Self, other: &ClassBytes) -> bool
impl RefUnwindSafe for ClassBytes
impl Send for ClassBytes
impl StructuralPartialEq for ClassBytes
impl Sync for ClassBytes
impl Unpin for ClassBytes
impl UnsafeUnpin for ClassBytes
impl UnwindSafe for ClassBytes
impl<T> Any for ClassBytes
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for ClassBytes
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for ClassBytes
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for ClassBytes
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for ClassBytes
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for ClassBytes
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for ClassBytes
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for ClassBytes
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for ClassBytes
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>