decancer

Macro cure

Source
macro_rules! cure {
    ($string:expr) => { ... };
}
Expand description

Cures a string with decancer’s default options.

Output will always be in lowercase and bidirectionally reordered in order to treat right-to-left characters. Therefore, the string output is laid out in memory the same way as it were to be displayed graphically, but may break if displayed graphically since some right-to-left characters are reversed.

If you plan on only using this macro, it’s recommended to disable the default options feature flag to optimize away unnecessary option checks.

This macro expands to:

decancer::cure(string, decancer::Options::default());

For more information, see the cure function.

§Errors

Errors if the string is malformed to the point where it’s not possible to apply unicode’s bidirectional algorithm to it.

§Examples

Basic usage:

let cured = decancer::cure!("vEⓡ𝔂 𝔽𝕌Ňℕy ţ乇𝕏𝓣").unwrap();

assert_eq!(cured, "very funny text");
assert!(cured.contains("FuNny"));