pub struct Skip;
Expand description
Type that can be returned from a callback, informing the Lexer
, to skip
current token match. See also logos::skip
.
§Example
use logos::{Logos, Skip};
#[derive(Logos, Debug, PartialEq)]
enum Token<'a> {
// We will treat "abc" as if it was whitespace.
// This is identical to using `logos::skip`.
#[regex(" |abc", |_| Skip, priority = 3)]
Ignored,
#[regex("[a-zA-Z]+")]
Text(&'a str),
}
let tokens: Vec<_> = Token::lexer("Hello abc world").collect();
assert_eq!(
tokens,
&[
Ok(Token::Text("Hello")),
Ok(Token::Text("world")),
],
);
Auto Trait Implementations§
impl Freeze for Skip
impl RefUnwindSafe for Skip
impl Send for Skip
impl Sync for Skip
impl Unpin for Skip
impl UnwindSafe for Skip
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more