Trait winnow::stream::ContainsToken

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

Check if a token in in a set of possible tokens

This is generally implemented on patterns that a token may match and supports u8 and char tokens along with the following patterns

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

§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: AsChar, F: Fn(C) -> bool> ContainsToken<C> for F