pub enum PairWise {
Paren,
Curly,
Square,
}
Expand description
Represents either the left or right Kind of a PairWise set.
Certain kinds have a PairWise equivalent:
- Kind::LeftParen has Kind::RightParen
- Kind::LeftCurly has Kind::RightCurly
- Kind::LeftSquare has Kind::RightSquare
The PairWise enum represents either one of the above listed Kinds. So for example PairWise::Paren represents both the Kind::LeftParen and Kind::RightParen.
§Example
use css_lexer::*;
let mut lexer = Lexer::new(&EmptyAtomSet::ATOMS, "(a)");
{
let token = lexer.advance();
assert_eq!(token, PairWise::Paren);
assert_eq!(token, Kind::LeftParen);
let pair: PairWise = token.to_pairwise().unwrap();
let mut close_token;
loop {
close_token = lexer.advance();
if close_token == pair {
break;
}
}
assert_eq!(close_token, Kind::RightParen);
}
Variants§
Implementations§
Trait Implementations§
Source§impl Ord for PairWise
impl Ord for PairWise
Source§impl PartialOrd for PairWise
impl PartialOrd for PairWise
impl Copy for PairWise
impl Eq for PairWise
impl StructuralPartialEq for PairWise
Auto Trait Implementations§
impl Freeze for PairWise
impl RefUnwindSafe for PairWise
impl Send for PairWise
impl Sync for PairWise
impl Unpin for PairWise
impl UnwindSafe for PairWise
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