icu_casemap/
lib.rs

1// This file is part of ICU4X. For terms of use, please see the file
2// called LICENSE at the top level of the ICU4X source tree
3// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
4
5//! Case mapping for Unicode characters and strings.
6//!
7//! This module is published as its own crate ([`icu_casemap`](https://docs.rs/icu_casemap/latest/icu_casemap/))
8//! and as part of the [`icu`](https://docs.rs/icu/latest/icu/) crate. See the latter for more details on the ICU4X project.
9//!
10//! # Examples
11//!
12//! ```rust
13//! use icu::casemap::CaseMapper;
14//! use icu::locale::langid;
15//!
16//! let cm = CaseMapper::new();
17//!
18//! assert_eq!(
19//!     cm.uppercase_to_string("hello world", &langid!("und")),
20//!     "HELLO WORLD"
21//! );
22//! assert_eq!(
23//!     cm.lowercase_to_string("Γειά σου Κόσμε", &langid!("und")),
24//!     "γειά σου κόσμε"
25//! );
26//! ```
27//!
28//! [`ICU4X`]: ../icu/index.html
29
30// https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations
31#![cfg_attr(not(any(test, doc)), no_std)]
32#![cfg_attr(
33    not(test),
34    deny(
35        clippy::indexing_slicing,
36        clippy::unwrap_used,
37        clippy::expect_used,
38        clippy::panic,
39        clippy::exhaustive_structs,
40        clippy::exhaustive_enums,
41        clippy::trivially_copy_pass_by_ref,
42        missing_debug_implementations,
43    )
44)]
45#![warn(missing_docs)]
46// We're using Greek identifiers here on purpose. These lints can only be disabled at the crate level
47#![allow(confusable_idents, uncommon_codepoints)]
48
49extern crate alloc;
50
51mod casemapper;
52mod closer;
53pub mod provider;
54mod set;
55pub(crate) mod titlecase;
56
57#[doc(hidden)] // testing
58#[allow(clippy::exhaustive_structs, clippy::exhaustive_enums)]
59pub mod greek_to_me;
60mod internals;
61
62pub use casemapper::{CaseMapper, CaseMapperBorrowed};
63pub use closer::{CaseMapCloser, CaseMapCloserBorrowed};
64pub use set::ClosureSink;
65pub use titlecase::{TitlecaseMapper, TitlecaseMapperBorrowed};
66
67/// Options used by types in this crate
68pub mod options {
69    pub use crate::titlecase::{LeadingAdjustment, TitlecaseOptions, TrailingCase};
70}