Struct precis_profiles::UsernameCaseMapped
source · pub struct UsernameCaseMapped(/* private fields */);
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§
source§impl UsernameCaseMapped
impl UsernameCaseMapped
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a UsernameCaseMapped
profile.
Trait Implementations§
source§impl Clone for UsernameCaseMapped
impl Clone for UsernameCaseMapped
source§fn clone(&self) -> UsernameCaseMapped
fn clone(&self) -> UsernameCaseMapped
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for UsernameCaseMapped
impl Debug for UsernameCaseMapped
source§impl Default for UsernameCaseMapped
impl Default for UsernameCaseMapped
source§fn default() -> UsernameCaseMapped
fn default() -> UsernameCaseMapped
Returns the “default value” for a type. Read more
source§impl PartialEq for UsernameCaseMapped
impl PartialEq for UsernameCaseMapped
source§impl PrecisFastInvocation for UsernameCaseMapped
impl PrecisFastInvocation for UsernameCaseMapped
source§fn prepare<'a, S>(s: S) -> Result<Cow<'a, str>, Error>
fn prepare<'a, S>(s: S) -> Result<Cow<'a, str>, Error>
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
source§fn enforce<'a, S>(s: S) -> Result<Cow<'a, str>, Error>
fn enforce<'a, S>(s: S) -> Result<Cow<'a, str>, Error>
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
source§impl Profile for UsernameCaseMapped
impl Profile for UsernameCaseMapped
source§fn prepare<'a, S>(&self, s: S) -> Result<Cow<'a, str>, Error>
fn prepare<'a, S>(&self, s: S) -> Result<Cow<'a, str>, Error>
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
source§fn enforce<'a, S>(&self, s: S) -> Result<Cow<'a, str>, Error>
fn enforce<'a, S>(&self, s: S) -> Result<Cow<'a, str>, Error>
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
source§impl Rules for UsernameCaseMapped
impl Rules for UsernameCaseMapped
source§fn width_mapping_rule<'a, T>(&self, s: T) -> Result<Cow<'a, str>, Error>
fn width_mapping_rule<'a, T>(&self, s: T) -> Result<Cow<'a, str>, Error>
Applies the width mapping rule of a profile to an input string. Read more
source§fn case_mapping_rule<'a, T>(&self, s: T) -> Result<Cow<'a, str>, Error>
fn case_mapping_rule<'a, T>(&self, s: T) -> Result<Cow<'a, str>, Error>
Applies the case mapping rule of a profile to an input string Read more
source§fn normalization_rule<'a, T>(&self, s: T) -> Result<Cow<'a, str>, Error>
fn normalization_rule<'a, T>(&self, s: T) -> Result<Cow<'a, str>, Error>
Applies the normalization rule of a profile to an input string Read more
impl Copy for UsernameCaseMapped
impl Eq for UsernameCaseMapped
impl StructuralPartialEq for UsernameCaseMapped
Auto Trait Implementations§
impl Freeze for UsernameCaseMapped
impl RefUnwindSafe for UsernameCaseMapped
impl Send for UsernameCaseMapped
impl Sync for UsernameCaseMapped
impl Unpin for UsernameCaseMapped
impl UnwindSafe for UsernameCaseMapped
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)