Expand description
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.
§Examples
Parsing and interpolating with a single-placeholder pattern:
use icu_pattern::SinglePlaceholderPattern;
use writeable::assert_writeable_eq;
// Parse a pattern string:
let pattern = SinglePlaceholderPattern::try_from_str(
    "Hello, {0}!",
    Default::default(),
)
.unwrap();
// Interpolate into the pattern string:
assert_writeable_eq!(pattern.interpolate(["World"]), "Hello, World!");Re-exports§
pub use PatternError as Error;
Structs§
- Missing
Named Placeholder Error  - Multi
Named Placeholder Key  - A string wrapper for the 
MultiNamedPlaceholderpattern backend. - Parser
 - Placeholder pattern parser.
 - Parser
Options  - Options passed to the constructor of 
Parser. - Pattern
 - A string pattern with placeholders.
 - Pattern
String  
Enums§
- Double
Placeholder  - Backend for patterns containing zero, one, or two placeholders.
 - Double
Placeholder Key  - A two-value enum for the 
DoublePlaceholderpattern backend. - Multi
Named Placeholder  - Backend for patterns containing zero or more named placeholders.
 - Parsed
Pattern Item  - A 
PatternItemwith additional detail returned by theParser. - Parser
Error  - An error returned when parsing a pattern.
 - Pattern
Error  - Pattern
Item  - A borrowed item in a 
Pattern. Items are either string literals or placeholders. - Pattern
Item Cow  - A borrowed-or-owned item in a 
Pattern. Items are either string literals or placeholders. - Quote
Mode  - Controls how quotes (
') are interpreted. - Single
Placeholder  - Backend for patterns containing zero or one placeholder.
 - Single
Placeholder Key  - A singleton enum for the 
SinglePlaceholderpattern backend. 
Traits§
- Pattern
Backend  - Types that implement backing data models for 
Patternimplement this trait. - Placeholder
Value Provider  - Trait implemented on collections that can produce 
TryWriteables for interpolation. 
Type Aliases§
- Double
Placeholder Pattern  - Examples
 - Multi
Named Placeholder Pattern  - Examples
 - Single
Placeholder Pattern  - Examples