winnow::stream

Trait ContainsToken

Source
pub trait ContainsToken<T> {
    // Required method
    fn contains_token(&self, token: T) -> bool;
}
Expand description

Check if a token is in a set of possible tokens

While this can be implemented manually, you can also build up sets using:

  • b'c' and 'c'
  • b""
  • |c| true
  • b'a'..=b'z', 'a'..='z' (etc for each range type)
  • (set1, set2, ...)

§Example

For example, you could implement hex_digit0 as:

fn hex_digit1<'s>(input: &mut &'s str) -> PResult<&'s str, InputError<&'s str>> {
    take_while(1.., ('a'..='f', 'A'..='F', '0'..='9')).parse_next(input)
}

assert_eq!(hex_digit1.parse_peek("21cZ"), Ok(("Z", "21c")));
assert_eq!(hex_digit1.parse_peek("H2"), Err(ErrMode::Backtrack(InputError::new("H2", ErrorKind::Slice))));
assert_eq!(hex_digit1.parse_peek(""), Err(ErrMode::Backtrack(InputError::new("", ErrorKind::Slice))));

Required Methods§

Source

fn contains_token(&self, token: T) -> bool

Returns true if self contains the token

Implementations on Foreign Types§

Source§

impl ContainsToken<char> for u8

Source§

fn contains_token(&self, token: char) -> bool

Source§

impl ContainsToken<u8> for u8

Source§

fn contains_token(&self, token: u8) -> bool

Source§

impl<'a> ContainsToken<&'a char> for u8

Source§

fn contains_token(&self, token: &char) -> bool

Source§

impl<'a> ContainsToken<&'a u8> for u8

Source§

fn contains_token(&self, token: &u8) -> bool

Source§

impl<C1: AsChar> ContainsToken<C1> for RangeFull

Source§

fn contains_token(&self, _token: C1) -> bool

Source§

impl<C1: AsChar, C2: AsChar + Clone> ContainsToken<C1> for Range<C2>

Source§

fn contains_token(&self, token: C1) -> bool

Source§

impl<C1: AsChar, C2: AsChar + Clone> ContainsToken<C1> for RangeFrom<C2>

Source§

fn contains_token(&self, token: C1) -> bool

Source§

impl<C1: AsChar, C2: AsChar + Clone> ContainsToken<C1> for RangeInclusive<C2>

Source§

fn contains_token(&self, token: C1) -> bool

Source§

impl<C1: AsChar, C2: AsChar + Clone> ContainsToken<C1> for RangeTo<C2>

Source§

fn contains_token(&self, token: C1) -> bool

Source§

impl<C1: AsChar, C2: AsChar + Clone> ContainsToken<C1> for RangeToInclusive<C2>

Source§

fn contains_token(&self, token: C1) -> bool

Source§

impl<C: AsChar> ContainsToken<C> for &[char]

Source§

fn contains_token(&self, token: C) -> bool

Source§

impl<C: AsChar> ContainsToken<C> for &[u8]

Source§

fn contains_token(&self, token: C) -> bool

Source§

impl<C: AsChar> ContainsToken<C> for char

Source§

fn contains_token(&self, token: C) -> bool

Source§

impl<T> ContainsToken<T> for ()

Source§

fn contains_token(&self, _token: T) -> bool

Source§

impl<T, F1> ContainsToken<T> for (F1,)
where T: Clone, F1: ContainsToken<T>,

Source§

fn contains_token(&self, token: T) -> bool

Source§

impl<T, F1, F2> ContainsToken<T> for (F1, F2)
where T: Clone, F1: ContainsToken<T>, F2: ContainsToken<T>,

Source§

fn contains_token(&self, token: T) -> bool

Source§

impl<T, F1, F2, F3> ContainsToken<T> for (F1, F2, F3)
where T: Clone, F1: ContainsToken<T>, F2: ContainsToken<T>, F3: ContainsToken<T>,

Source§

fn contains_token(&self, token: T) -> bool

Source§

impl<T, F1, F2, F3, F4> ContainsToken<T> for (F1, F2, F3, F4)
where T: Clone, F1: ContainsToken<T>, F2: ContainsToken<T>, F3: ContainsToken<T>, F4: ContainsToken<T>,

Source§

fn contains_token(&self, token: T) -> bool

Source§

impl<T, F1, F2, F3, F4, F5> ContainsToken<T> for (F1, F2, F3, F4, F5)
where T: Clone, F1: ContainsToken<T>, F2: ContainsToken<T>, F3: ContainsToken<T>, F4: ContainsToken<T>, F5: ContainsToken<T>,

Source§

fn contains_token(&self, token: T) -> bool

Source§

impl<T, F1, F2, F3, F4, F5, F6> ContainsToken<T> for (F1, F2, F3, F4, F5, F6)
where T: Clone, F1: ContainsToken<T>, F2: ContainsToken<T>, F3: ContainsToken<T>, F4: ContainsToken<T>, F5: ContainsToken<T>, F6: ContainsToken<T>,

Source§

fn contains_token(&self, token: T) -> bool

Source§

impl<T, F1, F2, F3, F4, F5, F6, F7> ContainsToken<T> for (F1, F2, F3, F4, F5, F6, F7)
where T: Clone, F1: ContainsToken<T>, F2: ContainsToken<T>, F3: ContainsToken<T>, F4: ContainsToken<T>, F5: ContainsToken<T>, F6: ContainsToken<T>, F7: ContainsToken<T>,

Source§

fn contains_token(&self, token: T) -> bool

Source§

impl<T, F1, F2, F3, F4, F5, F6, F7, F8> ContainsToken<T> for (F1, F2, F3, F4, F5, F6, F7, F8)
where T: Clone, F1: ContainsToken<T>, F2: ContainsToken<T>, F3: ContainsToken<T>, F4: ContainsToken<T>, F5: ContainsToken<T>, F6: ContainsToken<T>, F7: ContainsToken<T>, F8: ContainsToken<T>,

Source§

fn contains_token(&self, token: T) -> bool

Source§

impl<T, F1, F2, F3, F4, F5, F6, F7, F8, F9> ContainsToken<T> for (F1, F2, F3, F4, F5, F6, F7, F8, F9)
where T: Clone, F1: ContainsToken<T>, F2: ContainsToken<T>, F3: ContainsToken<T>, F4: ContainsToken<T>, F5: ContainsToken<T>, F6: ContainsToken<T>, F7: ContainsToken<T>, F8: ContainsToken<T>, F9: ContainsToken<T>,

Source§

fn contains_token(&self, token: T) -> bool

Source§

impl<T, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10> ContainsToken<T> for (F1, F2, F3, F4, F5, F6, F7, F8, F9, F10)
where T: Clone, F1: ContainsToken<T>, F2: ContainsToken<T>, F3: ContainsToken<T>, F4: ContainsToken<T>, F5: ContainsToken<T>, F6: ContainsToken<T>, F7: ContainsToken<T>, F8: ContainsToken<T>, F9: ContainsToken<T>, F10: ContainsToken<T>,

Source§

fn contains_token(&self, token: T) -> bool

Source§

impl<T, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11> ContainsToken<T> for (F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11)
where T: Clone, F1: ContainsToken<T>, F2: ContainsToken<T>, F3: ContainsToken<T>, F4: ContainsToken<T>, F5: ContainsToken<T>, F6: ContainsToken<T>, F7: ContainsToken<T>, F8: ContainsToken<T>, F9: ContainsToken<T>, F10: ContainsToken<T>, F11: ContainsToken<T>,

Source§

fn contains_token(&self, token: T) -> bool

Source§

impl<T, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12> ContainsToken<T> for (F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12)
where T: Clone, F1: ContainsToken<T>, F2: ContainsToken<T>, F3: ContainsToken<T>, F4: ContainsToken<T>, F5: ContainsToken<T>, F6: ContainsToken<T>, F7: ContainsToken<T>, F8: ContainsToken<T>, F9: ContainsToken<T>, F10: ContainsToken<T>, F11: ContainsToken<T>, F12: ContainsToken<T>,

Source§

fn contains_token(&self, token: T) -> bool

Source§

impl<T, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13> ContainsToken<T> for (F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13)
where T: Clone, F1: ContainsToken<T>, F2: ContainsToken<T>, F3: ContainsToken<T>, F4: ContainsToken<T>, F5: ContainsToken<T>, F6: ContainsToken<T>, F7: ContainsToken<T>, F8: ContainsToken<T>, F9: ContainsToken<T>, F10: ContainsToken<T>, F11: ContainsToken<T>, F12: ContainsToken<T>, F13: ContainsToken<T>,

Source§

fn contains_token(&self, token: T) -> bool

Source§

impl<T, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14> ContainsToken<T> for (F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14)
where T: Clone, F1: ContainsToken<T>, F2: ContainsToken<T>, F3: ContainsToken<T>, F4: ContainsToken<T>, F5: ContainsToken<T>, F6: ContainsToken<T>, F7: ContainsToken<T>, F8: ContainsToken<T>, F9: ContainsToken<T>, F10: ContainsToken<T>, F11: ContainsToken<T>, F12: ContainsToken<T>, F13: ContainsToken<T>, F14: ContainsToken<T>,

Source§

fn contains_token(&self, token: T) -> bool

Source§

impl<T, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15> ContainsToken<T> for (F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15)
where T: Clone, F1: ContainsToken<T>, F2: ContainsToken<T>, F3: ContainsToken<T>, F4: ContainsToken<T>, F5: ContainsToken<T>, F6: ContainsToken<T>, F7: ContainsToken<T>, F8: ContainsToken<T>, F9: ContainsToken<T>, F10: ContainsToken<T>, F11: ContainsToken<T>, F12: ContainsToken<T>, F13: ContainsToken<T>, F14: ContainsToken<T>, F15: ContainsToken<T>,

Source§

fn contains_token(&self, token: T) -> bool

Source§

impl<T, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16> ContainsToken<T> for (F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16)
where T: Clone, F1: ContainsToken<T>, F2: ContainsToken<T>, F3: ContainsToken<T>, F4: ContainsToken<T>, F5: ContainsToken<T>, F6: ContainsToken<T>, F7: ContainsToken<T>, F8: ContainsToken<T>, F9: ContainsToken<T>, F10: ContainsToken<T>, F11: ContainsToken<T>, F12: ContainsToken<T>, F13: ContainsToken<T>, F14: ContainsToken<T>, F15: ContainsToken<T>, F16: ContainsToken<T>,

Source§

fn contains_token(&self, token: T) -> bool

Source§

impl<T, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17> ContainsToken<T> for (F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17)
where T: Clone, F1: ContainsToken<T>, F2: ContainsToken<T>, F3: ContainsToken<T>, F4: ContainsToken<T>, F5: ContainsToken<T>, F6: ContainsToken<T>, F7: ContainsToken<T>, F8: ContainsToken<T>, F9: ContainsToken<T>, F10: ContainsToken<T>, F11: ContainsToken<T>, F12: ContainsToken<T>, F13: ContainsToken<T>, F14: ContainsToken<T>, F15: ContainsToken<T>, F16: ContainsToken<T>, F17: ContainsToken<T>,

Source§

fn contains_token(&self, token: T) -> bool

Source§

impl<T, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18> ContainsToken<T> for (F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18)
where T: Clone, F1: ContainsToken<T>, F2: ContainsToken<T>, F3: ContainsToken<T>, F4: ContainsToken<T>, F5: ContainsToken<T>, F6: ContainsToken<T>, F7: ContainsToken<T>, F8: ContainsToken<T>, F9: ContainsToken<T>, F10: ContainsToken<T>, F11: ContainsToken<T>, F12: ContainsToken<T>, F13: ContainsToken<T>, F14: ContainsToken<T>, F15: ContainsToken<T>, F16: ContainsToken<T>, F17: ContainsToken<T>, F18: ContainsToken<T>,

Source§

fn contains_token(&self, token: T) -> bool

Source§

impl<T, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19> ContainsToken<T> for (F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19)
where T: Clone, F1: ContainsToken<T>, F2: ContainsToken<T>, F3: ContainsToken<T>, F4: ContainsToken<T>, F5: ContainsToken<T>, F6: ContainsToken<T>, F7: ContainsToken<T>, F8: ContainsToken<T>, F9: ContainsToken<T>, F10: ContainsToken<T>, F11: ContainsToken<T>, F12: ContainsToken<T>, F13: ContainsToken<T>, F14: ContainsToken<T>, F15: ContainsToken<T>, F16: ContainsToken<T>, F17: ContainsToken<T>, F18: ContainsToken<T>, F19: ContainsToken<T>,

Source§

fn contains_token(&self, token: T) -> bool

Source§

impl<T, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20> ContainsToken<T> for (F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20)
where T: Clone, F1: ContainsToken<T>, F2: ContainsToken<T>, F3: ContainsToken<T>, F4: ContainsToken<T>, F5: ContainsToken<T>, F6: ContainsToken<T>, F7: ContainsToken<T>, F8: ContainsToken<T>, F9: ContainsToken<T>, F10: ContainsToken<T>, F11: ContainsToken<T>, F12: ContainsToken<T>, F13: ContainsToken<T>, F14: ContainsToken<T>, F15: ContainsToken<T>, F16: ContainsToken<T>, F17: ContainsToken<T>, F18: ContainsToken<T>, F19: ContainsToken<T>, F20: ContainsToken<T>,

Source§

fn contains_token(&self, token: T) -> bool

Source§

impl<T, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21> ContainsToken<T> for (F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21)
where T: Clone, F1: ContainsToken<T>, F2: ContainsToken<T>, F3: ContainsToken<T>, F4: ContainsToken<T>, F5: ContainsToken<T>, F6: ContainsToken<T>, F7: ContainsToken<T>, F8: ContainsToken<T>, F9: ContainsToken<T>, F10: ContainsToken<T>, F11: ContainsToken<T>, F12: ContainsToken<T>, F13: ContainsToken<T>, F14: ContainsToken<T>, F15: ContainsToken<T>, F16: ContainsToken<T>, F17: ContainsToken<T>, F18: ContainsToken<T>, F19: ContainsToken<T>, F20: ContainsToken<T>, F21: ContainsToken<T>,

Source§

fn contains_token(&self, token: T) -> bool

Source§

impl<const LEN: usize, C: AsChar> ContainsToken<C> for &[char; LEN]

Source§

fn contains_token(&self, token: C) -> bool

Source§

impl<const LEN: usize, C: AsChar> ContainsToken<C> for &[u8; LEN]

Source§

fn contains_token(&self, token: C) -> bool

Source§

impl<const LEN: usize, C: AsChar> ContainsToken<C> for [char; LEN]

Source§

fn contains_token(&self, token: C) -> bool

Source§

impl<const LEN: usize, C: AsChar> ContainsToken<C> for [u8; LEN]

Source§

fn contains_token(&self, token: C) -> bool

Implementors§

Source§

impl<C, F: Fn(C) -> bool> ContainsToken<C> for F