Struct precis_profiles::OpaqueString
source · pub struct OpaqueString(/* private fields */);
Expand description
OpaqueString
Profile designed to deal with passwords and other opaque strings in security
and application protocols.
Replaces: The SASLprep
profile of Stringprep
. Look at the
IANA
Considerations
section for more details.
§Example
// create OpaqueString profile
let profile = OpaqueString::new();
// prepare string
assert_eq!(profile.prepare("I'm Guybrush Threepwood, Mighty Pirate ☠"),
Ok(Cow::from("I'm Guybrush Threepwood, Mighty Pirate ☠")));
// enforce string
assert_eq!(profile.enforce("Look behind you, a three-headed monkey!🐒"),
Ok(Cow::from("Look behind you, a three-headed monkey!🐒")));
// compare strings
assert_eq!(profile.compare("That’s the second biggest 🐵 I’ve ever seen!",
"That’s the second biggest 🐵 I’ve ever seen!"), Ok(true));
Implementations§
source§impl OpaqueString
impl OpaqueString
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a OpaqueString
profile.
Trait Implementations§
source§impl Clone for OpaqueString
impl Clone for OpaqueString
source§fn clone(&self) -> OpaqueString
fn clone(&self) -> OpaqueString
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 OpaqueString
impl Debug for OpaqueString
source§impl Default for OpaqueString
impl Default for OpaqueString
source§fn default() -> OpaqueString
fn default() -> OpaqueString
Returns the “default value” for a type. Read more
source§impl PartialEq for OpaqueString
impl PartialEq for OpaqueString
source§impl PrecisFastInvocation for OpaqueString
impl PrecisFastInvocation for OpaqueString
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 OpaqueString
impl Profile for OpaqueString
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 OpaqueString
impl Rules for OpaqueString
source§fn additional_mapping_rule<'a, T>(&self, s: T) -> Result<Cow<'a, str>, Error>
fn additional_mapping_rule<'a, T>(&self, s: T) -> Result<Cow<'a, str>, Error>
Applies the additional 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
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
impl Copy for OpaqueString
impl Eq for OpaqueString
impl StructuralPartialEq for OpaqueString
Auto Trait Implementations§
impl Freeze for OpaqueString
impl RefUnwindSafe for OpaqueString
impl Send for OpaqueString
impl Sync for OpaqueString
impl Unpin for OpaqueString
impl UnwindSafe for OpaqueString
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
)