Struct precis_profiles::Nickname
source · [−]pub struct Nickname(_);Expand description
Nickname.
Nicknames or display names in messaging and text conferencing technologies;
pet names for devices, accounts, and people; and other uses of nicknames,
display names, or pet names. Look at the
IANA Considerations
section for more details.
Example
// create Nickname profile
let profile = Nickname::new();
// prepare string
assert_eq!(profile.prepare("Guybrush Threepwood"),
Ok(Cow::from("Guybrush Threepwood")));
// enforce string
assert_eq!(profile.enforce(" Guybrush Threepwood "),
Ok(Cow::from("Guybrush Threepwood")));
// compare strings
assert_eq!(profile.compare("Guybrush Threepwood ",
"guybrush threepwood"), Ok(true));Implementations
Trait Implementations
sourceimpl PrecisFastInvocation for Nickname
impl PrecisFastInvocation for Nickname
sourcefn prepare<'a, S>(s: S) -> Result<Cow<'a, str>, Error> where
S: Into<Cow<'a, str>>,
fn prepare<'a, S>(s: S) -> Result<Cow<'a, str>, Error> where
S: Into<Cow<'a, str>>,
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
sourcefn enforce<'a, S>(s: S) -> Result<Cow<'a, str>, Error> where
S: Into<Cow<'a, str>>,
fn enforce<'a, S>(s: S) -> Result<Cow<'a, str>, Error> where
S: Into<Cow<'a, str>>,
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
sourcefn compare<A, B>(s1: A, s2: B) -> Result<bool, Error> where
A: AsRef<str>,
B: AsRef<str>,
fn compare<A, B>(s1: A, s2: B) -> Result<bool, Error> where
A: AsRef<str>,
B: AsRef<str>,
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
sourceimpl Profile for Nickname
impl Profile for Nickname
sourcefn prepare<'a, S>(&self, s: S) -> Result<Cow<'a, str>, Error> where
S: Into<Cow<'a, str>>,
fn prepare<'a, S>(&self, s: S) -> Result<Cow<'a, str>, Error> where
S: Into<Cow<'a, str>>,
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
sourcefn enforce<'a, S>(&self, s: S) -> Result<Cow<'a, str>, Error> where
S: Into<Cow<'a, str>>,
fn enforce<'a, S>(&self, s: S) -> Result<Cow<'a, str>, Error> where
S: Into<Cow<'a, str>>,
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
sourcefn compare<A, B>(&self, s1: A, s2: B) -> Result<bool, Error> where
A: AsRef<str>,
B: AsRef<str>,
fn compare<A, B>(&self, s1: A, s2: B) -> Result<bool, Error> where
A: AsRef<str>,
B: AsRef<str>,
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
sourceimpl Rules for Nickname
impl Rules for Nickname
sourcefn additional_mapping_rule<'a, T>(&self, s: T) -> Result<Cow<'a, str>, Error> where
T: Into<Cow<'a, str>>,
fn additional_mapping_rule<'a, T>(&self, s: T) -> Result<Cow<'a, str>, Error> where
T: Into<Cow<'a, str>>,
Applies the additional mapping rule of a profile to an input string. Read more
sourcefn case_mapping_rule<'a, T>(&self, s: T) -> Result<Cow<'a, str>, Error> where
T: Into<Cow<'a, str>>,
fn case_mapping_rule<'a, T>(&self, s: T) -> Result<Cow<'a, str>, Error> where
T: Into<Cow<'a, str>>,
Applies the case mapping rule of a profile to an input string Read more
sourcefn normalization_rule<'a, T>(&self, s: T) -> Result<Cow<'a, str>, Error> where
T: Into<Cow<'a, str>>,
fn normalization_rule<'a, T>(&self, s: T) -> Result<Cow<'a, str>, Error> where
T: Into<Cow<'a, str>>,
Applies the normalization rule of a profile to an input string Read more
impl Copy for Nickname
impl Eq for Nickname
impl StructuralEq for Nickname
impl StructuralPartialEq for Nickname
Auto Trait Implementations
impl RefUnwindSafe for Nickname
impl Send for Nickname
impl Sync for Nickname
impl Unpin for Nickname
impl UnwindSafe for Nickname
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more