rocket::http::uncased

Function eq

Source
pub fn eq<S1, S2>(s1: S1, s2: S2) -> bool
where S1: AsRef<str>, S2: AsRef<str>,
Expand description

Returns true if s1 and s2 are equal without considering case.

That is, this function returns s1.to_ascii_lowercase() == s2.to_ascii_lowercase(), but does it in a much faster way. This is also equivalent to UncasedStr::new(s1) == UncasedStr::new(s2).

ยงExample

assert!(uncased::eq("ENV", "env"));
assert!(uncased::eq("bRoWN", "BROWN"));
assert!(uncased::eq("hi", "HI"));
assert!(uncased::eq("dogs are COOL!", "DOGS are cool!"));