[][src]Enum http_desync_guardian::http_token_utils::TokenSimilarity

pub enum TokenSimilarity {
    Identical,
    SameLetters,
    Distant,
}

Variants

Identical

If two token are identical, i.e. equal ignoring case.

use http_desync_guardian::http_token_utils::*;
use http_desync_guardian::http_token_utils::TokenSimilarity::*;

assert_eq!(determine_similarity(http_token("token"), http_token("Token")), Identical);
assert_eq!(determine_similarity(http_token("same-token"), http_token("Same-Token")), Identical);
SameLetters

If two tokens differ only by non-letter characters.

use http_desync_guardian::http_token_utils::*;
use http_desync_guardian::http_token_utils::TokenSimilarity::*;

assert_eq!(determine_similarity(http_token("token"), http_token("Token\t")), SameLetters);
assert_eq!(determine_similarity(http_token("same-token"), http_token("Same\t-Token")), SameLetters);
Distant

Otherwise it's Distant. E.g. "some-token" and "other-token"

use http_desync_guardian::http_token_utils::*;
use http_desync_guardian::http_token_utils::TokenSimilarity::*;

assert_eq!(determine_similarity(http_token("token"), http_token("Different-token")), Distant);
assert_eq!(determine_similarity(http_token("same-token"), http_token("Other-token")), Distant);

Trait Implementations

impl Debug for TokenSimilarity[src]

impl PartialEq<TokenSimilarity> for TokenSimilarity[src]

impl PartialOrd<TokenSimilarity> for TokenSimilarity[src]

impl StructuralPartialEq for TokenSimilarity[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.