Enum Look

enum Look

The high-level intermediate representation for a look-around assertion.

An assertion match is always zero-length. Also called an "empty match."

Variants

Start

Match the beginning of text. Specifically, this matches at the starting position of the input.

End

Match the end of text. Specifically, this matches at the ending position of the input.

StartLF

Match the beginning of a line or the beginning of text. Specifically, this matches at the starting position of the input, or at the position immediately following a \n character.

EndLF

Match the end of a line or the end of text. Specifically, this matches at the end position of the input, or at the position immediately preceding a \n character.

StartCRLF

Match the beginning of a line or the beginning of text. Specifically, this matches at the starting position of the input, or at the position immediately following either a \r or \n character, but never after a \r when a \n follows.

EndCRLF

Match the end of a line or the end of text. Specifically, this matches at the end position of the input, or at the position immediately preceding a \r or \n character, but never before a \n when a \r precedes it.

WordAscii

Match an ASCII-only word boundary. That is, this matches a position where the left adjacent character and right adjacent character correspond to a word and non-word or a non-word and word character.

WordAsciiNegate

Match an ASCII-only negation of a word boundary.

WordUnicode

Match a Unicode-aware word boundary. That is, this matches a position where the left adjacent character and right adjacent character correspond to a word and non-word or a non-word and word character.

WordUnicodeNegate

Match a Unicode-aware negation of a word boundary.

WordStartAscii

Match the start of an ASCII-only word boundary. That is, this matches a position at either the beginning of the haystack or where the previous character is not a word character and the following character is a word character.

WordEndAscii

Match the end of an ASCII-only word boundary. That is, this matches a position at either the end of the haystack or where the previous character is a word character and the following character is not a word character.

WordStartUnicode

Match the start of a Unicode word boundary. That is, this matches a position at either the beginning of the haystack or where the previous character is not a word character and the following character is a word character.

WordEndUnicode

Match the end of a Unicode word boundary. That is, this matches a position at either the end of the haystack or where the previous character is a word character and the following character is not a word character.

WordStartHalfAscii

Match the start half of an ASCII-only word boundary. That is, this matches a position at either the beginning of the haystack or where the previous character is not a word character.

WordEndHalfAscii

Match the end half of an ASCII-only word boundary. That is, this matches a position at either the end of the haystack or where the following character is not a word character.

WordStartHalfUnicode

Match the start half of a Unicode word boundary. That is, this matches a position at either the beginning of the haystack or where the previous character is not a word character.

WordEndHalfUnicode

Match the end half of a Unicode word boundary. That is, this matches a position at either the end of the haystack or where the following character is not a word character.

Implementations

impl Look

const fn reversed(self: Self) -> Look

Flip the look-around assertion to its equivalent for reverse searches. For example, StartLF gets translated to EndLF.

Some assertions, such as WordUnicode, remain the same since they match the same positions regardless of the direction of the search.

const fn as_repr(self: Self) -> u32

Return the underlying representation of this look-around enumeration as an integer. Giving the return value to the Look::from_repr constructor is guaranteed to return the same look-around variant that one started with within a semver compatible release of this crate.

const fn from_repr(repr: u32) -> Option<Look>

Given the underlying representation of a Look value, return the corresponding Look value if the representation is valid. Otherwise None is returned.

const fn as_char(self: Self) -> char

Returns a convenient single codepoint representation of this look-around assertion. Each assertion is guaranteed to be represented by a distinct character.

This is useful for succinctly representing a look-around assertion in human friendly but succinct output intended for a programmer working on regex internals.

impl Clone for Look

fn clone(self: &Self) -> Look

impl Copy for Look

impl Debug for Look

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

impl Eq for Look

impl Freeze for Look

impl PartialEq for Look

fn eq(self: &Self, other: &Look) -> bool

impl RefUnwindSafe for Look

impl Send for Look

impl StructuralPartialEq for Look

impl Sync for Look

impl Unpin for Look

impl UnsafeUnpin for Look

impl UnwindSafe for Look

impl<T> Any for Look

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Look

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Look

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

impl<T> CloneToUninit for Look

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for Look

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Look

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for Look

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for Look

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

impl<T, U> TryInto for Look

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