diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:41 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:41 +0000 |
commit | 4f9fe856a25ab29345b90e7725509e9ee38a37be (patch) | |
tree | e4ffd8a9374cae7b21f7cbfb352927e0e074aff6 /vendor/icu_locid/src/lib.rs | |
parent | Adding upstream version 1.68.2+dfsg1. (diff) | |
download | rustc-5cd5bd4daf55da04d2c8e7c06c3067a027cfbfc2.tar.xz rustc-5cd5bd4daf55da04d2c8e7c06c3067a027cfbfc2.zip |
Adding upstream version 1.69.0+dfsg1.upstream/1.69.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | vendor/icu_locid/src/lib.rs | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/vendor/icu_locid/src/lib.rs b/vendor/icu_locid/src/lib.rs index 885c4b743..226a8e53c 100644 --- a/vendor/icu_locid/src/lib.rs +++ b/vendor/icu_locid/src/lib.rs @@ -22,39 +22,23 @@ //! # Examples //! //! ``` -//! use icu::locid::subtags::{Language, Region}; //! use icu::locid::Locale; +//! use icu::locid::{ +//! locale, subtags_language as language, subtags_region as region, +//! }; //! -//! let mut loc: Locale = "en-US".parse().expect("Parsing failed."); -//! -//! let lang: Language = "en".parse().expect("Parsing failed."); -//! let region: Region = "US".parse().expect("Parsing failed."); +//! let mut loc: Locale = locale!("en-US"); //! -//! assert_eq!(loc.id.language, lang); +//! assert_eq!(loc.id.language, language!("en")); //! assert_eq!(loc.id.script, None); -//! assert_eq!(loc.id.region, Some(region)); +//! assert_eq!(loc.id.region, Some(region!("US"))); //! assert_eq!(loc.id.variants.len(), 0); //! -//! let region: Region = "GB".parse().expect("Parsing failed."); -//! loc.id.region = Some(region); +//! loc.id.region = Some(region!("GB")); //! -//! assert_eq!(loc.to_string(), "en-GB"); +//! assert_eq!(loc, locale!("en-GB")); //! ``` //! -//! ## Macros -//! -//! ```rust -//! use icu::locid::{ -//! langid, subtags_language as language, subtags_region as region, -//! }; -//! -//! let lid = langid!("EN_US"); -//! -//! assert_eq!(lid.language, language!("en")); -//! assert_eq!(lid.region, Some(region!("US"))); -//! ``` - -//! //! For more details, see [`Locale`] and [`LanguageIdentifier`]. //! //! [`UTS #35: Unicode LDML 3. Unicode Language and Locale Identifiers`]: https://unicode.org/reports/tr35/tr35.html#Unicode_Language_and_Locale_Identifiers |