Struct Caseless

struct Caseless<T>(1731)

Mark a value as case-insensitive for ASCII characters

Example

# use winnow::prelude::*;
# use winnow::ascii::Caseless;

fn parser<'s>(s: &mut &'s str) -> ModalResult<&'s str> {
  Caseless("hello").parse_next(s)
}

assert_eq!(parser.parse_peek("Hello, World!"), Ok((", World!", "Hello")));
assert_eq!(parser.parse_peek("hello, World!"), Ok((", World!", "hello")));
assert_eq!(parser.parse_peek("HeLlo, World!"), Ok((", World!", "HeLlo")));
assert!(parser.parse_peek("Some").is_err());
assert!(parser.parse_peek("").is_err());

Implementations

impl Caseless<&str>

fn as_bytes(self: &Self) -> Caseless<&[u8]>

Get the byte-representation of this case-insensitive value

impl<'s, I, E: ParserError<I>> Parser for Caseless<&'s [u8]>

fn parse_next(self: &mut Self, i: &mut I) -> Result<<I as Stream>::Slice, E>

impl<'s, I, E: ParserError<I>> Parser for Caseless<&'s str>

fn parse_next(self: &mut Self, i: &mut I) -> Result<<I as Stream>::Slice, E>

impl<'s, I, E: ParserError<I>, N: usize> Parser for Caseless<&'s [u8; N]>

fn parse_next(self: &mut Self, i: &mut I) -> Result<<I as Stream>::Slice, E>

impl<I, O, E, P> ModalParser for Caseless<T>

impl<S: SliceLen> SliceLen for Caseless<S>

fn slice_len(self: &Self) -> usize

impl<T> Any for Caseless<T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Caseless<T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Caseless<T>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for Caseless<T>

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

impl<T> Freeze for Caseless<T>

impl<T> From for Caseless<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> RefUnwindSafe for Caseless<T>

impl<T> Send for Caseless<T>

impl<T> Sync for Caseless<T>

impl<T> Unpin for Caseless<T>

impl<T> UnsafeUnpin for Caseless<T>

impl<T> UnwindSafe for Caseless<T>

impl<T, U> Into for Caseless<T>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Caseless<T>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Caseless<T>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>

impl<T: $crate::clone::Clone> Clone for Caseless<T>

fn clone(self: &Self) -> Caseless<T>

impl<T: $crate::fmt::Debug> Debug for Caseless<T>

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

impl<T: $crate::marker::Copy> Copy for Caseless<T>