Crates.io | icu_pattern |
lib.rs | icu_pattern |
version | 0.2.0 |
source | src |
created_at | 2021-04-29 18:14:41.646151 |
updated_at | 2024-05-28 20:14:41.89874 |
description | ICU pattern utilities |
homepage | |
repository | https://github.com/unicode-org/icu4x |
max_upload_size | |
id | 391171 |
size | 119,582 |
icu_pattern
is a utility crate of the ICU4X
project.
It includes a [Pattern
] type which supports patterns with various storage backends.
The types are tightly coupled with the [writeable
] crate.
Parsing and interpolating with a single-placeholder pattern:
use icu_pattern::SinglePlaceholderPattern;
use writeable::assert_writeable_eq;
// Parse a pattern string:
let pattern = "Hello, {0}!"
.parse::<SinglePlaceholderPattern<_>>()
.unwrap();
// Interpolate into the pattern string:
assert_writeable_eq!(pattern.interpolate(["World"]), "Hello, World!");
// Introspect the serialized form of the pattern string:
assert_eq!(pattern.take_store(), "\x08Hello, !");
For more information on development, authorship, contributing etc. please visit ICU4X home page
.