pub trait Profile {
// Required methods
fn prepare<'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>>;
fn compare<A, B>(&self, s1: A, s2: B) -> Result<bool, Error>
where A: AsRef<str>,
B: AsRef<str>;
}
Expand description
Profile enables application protocols to apply the string classes in ways that are appropriate for common constructs.
Required Methods§
Sourcefn 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.
§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
Sourcefn 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.
§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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.