Skip to main content

Crate disarm

Crate disarm 

Source
Expand description

Fast Unicode transliteration, slugification, and text normalization.

disarm is a pure-Rust core (no Python, no pyo3 in the default build) for Unicode text-security and canonicalization: TR39 confusable folding, bidi / zero-width / zalgo neutralization, normalization, grapheme/width measurement, slugification, and standards-based transliteration.

The public Rust API lives in crate::api; the error types are Error, ErrorKind, and ErrorMode. Everything else is an internal implementation detail (pub(crate) or #[doc(hidden)]) and carries no stability guarantee — see docs/RUST_API.md.

The Python extension (disarm._core) is an opt-in layer behind the extension-module feature and is not built into the default crate.

use disarm::{api, DisarmStr};
// ASCII passes through unchanged; non-ASCII is romanized to ASCII.
assert_eq!(api::strip_accents("café"), "cafe");
assert_eq!(api::transliterate("Москва"), "Moskva");
// …or via the extension trait:
assert_eq!("Москва".transliterate(), "Moskva");

Re-exports§

pub use api::DisarmStr;

Modules§

api
Layer 2: the idiomatic, pyo3-free Rust API — the crates.io surface (#38).

Structs§

Error
The error type returned by disarm’s fallible Rust API (crate::api).

Enums§

ErrorKind
Coarse, stable classification of an Error (#38).
ErrorMode
Error handling mode for operations that encounter untranslatable/unknown input.