Struct LookSet
struct LookSet { ... }
A set of look-around assertions.
This is useful for efficiently tracking look-around assertions. For
example, an Hir provides properties that return LookSets.
Fields
bits: u32The underlying representation this set is exposed to make it possible to store it somewhere efficiently. The representation is that of a bitset, where each assertion occupies bit
iwherei = Look::as_repr().Note that users of this internal representation must permit the full range of
u16values to be represented. For example, even if the current implementation only makes use of the 10 least significant bits, it may use more bits in a future semver compatible release.
Implementations
impl LookSet
fn empty() -> LookSetCreate an empty set of look-around assertions.
fn full() -> LookSetCreate a full set of look-around assertions.
This set contains all possible look-around assertions.
fn singleton(look: Look) -> LookSetCreate a look-around set containing the look-around assertion given.
This is a convenience routine for creating an empty set and inserting one look-around assertions.
fn len(self: Self) -> usizeReturns the total number of look-around assertions in this set.
fn is_empty(self: Self) -> boolReturns true if and only if this set is empty.
fn contains(self: Self, look: Look) -> boolReturns true if and only if the given look-around assertion is in this set.
fn contains_anchor(self: &Self) -> boolReturns true if and only if this set contains any anchor assertions. This includes both "start/end of haystack" and "start/end of line."
fn contains_anchor_haystack(self: &Self) -> boolReturns true if and only if this set contains any "start/end of haystack" anchors. This doesn't include "start/end of line" anchors.
fn contains_anchor_line(self: &Self) -> boolReturns true if and only if this set contains any "start/end of line" anchors. This doesn't include "start/end of haystack" anchors. This includes both
\nline anchors and CRLF (\r\n) aware line anchors.fn contains_anchor_lf(self: &Self) -> boolReturns true if and only if this set contains any "start/end of line" anchors that only treat
\nas line terminators. This does not include haystack anchors or CRLF aware line anchors.fn contains_anchor_crlf(self: &Self) -> boolReturns true if and only if this set contains any "start/end of line" anchors that are CRLF-aware. This doesn't include "start/end of haystack" or "start/end of line-feed" anchors.
fn contains_word(self: Self) -> boolReturns true if and only if this set contains any word boundary or negated word boundary assertions. This include both Unicode and ASCII word boundaries.
fn contains_word_unicode(self: Self) -> boolReturns true if and only if this set contains any Unicode word boundary or negated Unicode word boundary assertions.
fn contains_word_ascii(self: Self) -> boolReturns true if and only if this set contains any ASCII word boundary or negated ASCII word boundary assertions.
fn iter(self: Self) -> LookSetIterReturns an iterator over all of the look-around assertions in this set.
fn insert(self: Self, look: Look) -> LookSetReturn a new set that is equivalent to the original, but with the given assertion added to it. If the assertion is already in the set, then the returned set is equivalent to the original.
fn set_insert(self: &mut Self, look: Look)Updates this set in place with the result of inserting the given assertion into this set.
fn remove(self: Self, look: Look) -> LookSetReturn a new set that is equivalent to the original, but with the given assertion removed from it. If the assertion is not in the set, then the returned set is equivalent to the original.
fn set_remove(self: &mut Self, look: Look)Updates this set in place with the result of removing the given assertion from this set.
fn subtract(self: Self, other: LookSet) -> LookSetReturns a new set that is the result of subtracting the given set from this set.
fn set_subtract(self: &mut Self, other: LookSet)Updates this set in place with the result of subtracting the given set from this set.
fn union(self: Self, other: LookSet) -> LookSetReturns a new set that is the union of this and the one given.
fn set_union(self: &mut Self, other: LookSet)Updates this set in place with the result of unioning it with the one given.
fn intersect(self: Self, other: LookSet) -> LookSetReturns a new set that is the intersection of this and the one given.
fn set_intersect(self: &mut Self, other: LookSet)Updates this set in place with the result of intersecting it with the one given.
fn read_repr(slice: &[u8]) -> LookSetReturn a
LookSetfrom the slice given as a native endian 32-bit integer.Panics
This panics if
slice.len() < 4.fn write_repr(self: Self, slice: &mut [u8])Write a
LookSetas a native endian 32-bit integer to the beginning of the slice given.Panics
This panics if
slice.len() < 4.
impl Clone for LookSet
fn clone(self: &Self) -> LookSet
impl Copy for LookSet
impl Debug for LookSet
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Default for LookSet
fn default() -> LookSet
impl Eq for LookSet
impl Freeze for LookSet
impl PartialEq for LookSet
fn eq(self: &Self, other: &LookSet) -> bool
impl RefUnwindSafe for LookSet
impl Send for LookSet
impl StructuralPartialEq for LookSet
impl Sync for LookSet
impl Unpin for LookSet
impl UnsafeUnpin for LookSet
impl UnwindSafe for LookSet
impl<T> Any for LookSet
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for LookSet
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for LookSet
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for LookSet
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for LookSet
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for LookSet
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for LookSet
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 LookSet
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for LookSet
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>