Skip to main content

NotFollowedBy

Struct NotFollowedBy 

Source
pub struct NotFollowedBy<G>(/* private fields */);
Expand description

Zero-width negative lookahead: matches the empty string, but only when the following input does not match the wrapped grammar. Consumes nothing and prints nothing.

// "/" that is not the start of a "//" line comment.
#[derive(Grammar)]
struct Div(StringEq!("/"), NotFollowedBy<StringEq!("/")>);
assert!(Div::parse("/").is_ok());
assert!(Div::parse("//").is_err());

Trait Implementations§

Source§

impl<G> Clone for NotFollowedBy<G>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<G> Copy for NotFollowedBy<G>

Source§

impl<G> Debug for NotFollowedBy<G>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<G> Default for NotFollowedBy<G>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<G> Eq for NotFollowedBy<G>

Source§

impl<G: Grammar> Grammar for NotFollowedBy<G>

Source§

type First = OptionalFirst<EmptyByteSet>

The set of bytes (and whether empty input is valid) this grammar could start with.
Source§

fn parse_at(input: &str, pos: usize, state: State<'_>) -> Option<(Self, usize)>

Attempt to parse Self starting at pos, returning the value and the position just past it, or None on failure.
Source§

fn scan_at(input: &str, pos: usize, state: State<'_>) -> Option<usize>

Like parse_at, but only checks well-formedness and returns the end position.
Source§

fn print_to(&self, _buf: &mut String)

Serialize self back to text, appending to buf.
Source§

fn to_bnf() -> Expr

Describe this grammar as a BNF/EBNF expression, for use in a referencing rule’s own definition.
Source§

fn fail_at(_pos: usize, _state: State<'_>) -> bool

Record what this grammar would have expected at pos, without attempting to actually parse — used when a caller already knows (e.g. via First) that this alternative cannot match here, but still wants it traced. Read more
Source§

fn parse(input: &str) -> Result<Self, Error>

Parse the entire input as Self, failing if any input is left unconsumed.
Source§

fn parse_prefix(input: &str) -> Result<(Self, usize), Error>

Like parse, but doesn’t require consuming all of input — returns the byte position just past the match, leaving any remaining input unexamined.
Source§

fn scan(input: &str) -> Result<(), Error>

Like parse, but only checks that input is well-formed and discards the parsed value.
Source§

fn scan_prefix(input: &str) -> Result<usize, Error>

Like scan, but doesn’t require consuming all of input — returns the byte position just past the match, leaving any remaining input unexamined.
Source§

fn print(&self) -> String

Serialize self to a new String; see print_to.
Source§

impl<G> Hash for NotFollowedBy<G>

Source§

fn hash<H: Hasher>(&self, _state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<G> PartialEq for NotFollowedBy<G>

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

§

impl<G> Freeze for NotFollowedBy<G>

§

impl<G> RefUnwindSafe for NotFollowedBy<G>
where G: RefUnwindSafe,

§

impl<G> Send for NotFollowedBy<G>
where G: Send,

§

impl<G> Sync for NotFollowedBy<G>
where G: Sync,

§

impl<G> Unpin for NotFollowedBy<G>
where G: Unpin,

§

impl<G> UnsafeUnpin for NotFollowedBy<G>

§

impl<G> UnwindSafe for NotFollowedBy<G>
where G: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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>,

Source§

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.