Function precis_core::profile::stabilize

source ·
pub fn stabilize<'a, F, S>(s: S, f: F) -> Result<Cow<'a, str>, Error>
where S: Into<Cow<'a, str>>, F: for<'b> Fn(&'b str) -> Result<Cow<'b, str>, Error>,
Expand description

Apply rules until the string is stable. Some profiles, especially those that the result of applying these rules does not result in an idempotent operation for all code points SHOULD apply the rules repeatedly until the output string is stable.

§Arguments:

  • s: String value
  • f: Callback to invoke to apply the rules to s

§Returns

The stable string after applying the rules; if the output string does not stabilize after reapplying the rules three (3) additional times after the first application, the string is rejected as invalid.