Trait precis_core::profile::PrecisFastInvocation[][src]

pub trait PrecisFastInvocation {
    fn prepare(s: &str) -> Result<Cow<'_, str>, Error>;
fn enforce(s: &str) -> Result<Cow<'_, str>, Error>;
fn compare(s1: &str, s2: &str) -> Result<bool, Error>; }
Expand description

Fast invocation trait that allows profiles to be used without providing a specific instance. This is usually achieved by using a static instance allocated with lazy_static

Required methods

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.

Arguments:
  • s: String value
Returns

The same string if no modification were required or a new allocated string if s needed further modifications as a result of applying the rules defined by this profile to prepare the string

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.

Arguments:
  • s: String value
Returns

The same string if no modification were required or a new allocated string if s needed further modifications as a result of enforcing the string according to the rules defined by this profile.

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.

Implementors