pub struct UsernameCaseMapped(_);
Expand description

UsernameCaseMapped. Profile designed to deal with usernames in security and application protocols. It replaces the SASLprep profile of Stringprep. Look at the IANA Considerations section for more details.

Example

// create UsernameCaseMapped profile
let profile = UsernameCaseMapped::new();

// prepare string
assert_eq!(profile.prepare("Guybrush"), Ok(Cow::from("Guybrush")));

// UsernameCaseMapped does not accept spaces. Unicode code point 0x0020
assert_eq!(profile.prepare("Guybrush Threepwood"),
   Err(Error::BadCodepoint(CodepointInfo { cp: 0x0020, position: 8, property: DerivedPropertyValue::SpecClassDis })));

// enforce string
assert_eq!(profile.enforce("Guybrush"), Ok(Cow::from("guybrush")));

// compare strings
assert_eq!(profile.compare("Guybrush", "guybrush"), Ok(true));

Implementations

Creates a UsernameCaseMapped profile.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Ensures that the code points in a single input string are allowed by the underlying PRECIS string class, and sometimes also entails applying one or more of the rules specified for a particular string class or profile thereof. Read more

Applies all rules specified for a particular string class, or profile thereof, to a single input string, for the purpose of checking whether the string conforms to all the rules and thus determining if the string can be used in a given protocol slot. Read more

Comparison entails applying all the rules specified for a particular string class, or profile thereof, to two separate input strings, for the purpose of determining if the two strings are equivalent. Read more

Ensures that the code points in a single input string are allowed by the underlying PRECIS string class, and sometimes also entails applying one or more of the rules specified for a particular string class or profile thereof. Read more

Applies all the rules specified for a particular string class, or profile thereof, to a single input string, for the purpose of checking whether the string conforms to all the rules and thus determining if the string can be used in a given protocol slot. Read more

Comparison entails applying all the rules specified for a particular string class, or profile thereof, to two separate input strings, for the purpose of determining if the two strings are equivalent. Read more

Applies the width mapping rule of a profile to an input string. Read more

Applies the case mapping rule of a profile to an input string Read more

Applies the normalization rule of a profile to an input string Read more

Applies the directionality rule of a profile to an input string Read more

Applies the additional mapping rule of a profile to an input string. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.