diff options
Diffstat (limited to 'vendor/unic-langid')
-rw-r--r-- | vendor/unic-langid/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/unic-langid/Cargo.toml | 20 | ||||
-rw-r--r-- | vendor/unic-langid/src/lib.rs | 31 |
3 files changed, 36 insertions, 17 deletions
diff --git a/vendor/unic-langid/.cargo-checksum.json b/vendor/unic-langid/.cargo-checksum.json index 67ac5998f..a24497bb6 100644 --- a/vendor/unic-langid/.cargo-checksum.json +++ b/vendor/unic-langid/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"927c0bc2dea454aab20d550b4ab728ee5c3803ac12f95a89f518b8a56633e941","README.md":"f68b87b732b8a0d7fe6bc3b4ff5989207e87bd51f98220136ced4cd65f814f7c","src/lib.rs":"4f5812d6d76581105e85b09227f91544bc0f32b77ccda470953865b70fa74f53"},"package":"73328fcd730a030bdb19ddf23e192187a6b01cd98be6d3140622a89129459ce5"}
\ No newline at end of file +{"files":{"Cargo.toml":"22c66abe20079b152feec2c6e54c2026fcfe5b896fb20f7b45b1f5d11690aecd","README.md":"f68b87b732b8a0d7fe6bc3b4ff5989207e87bd51f98220136ced4cd65f814f7c","src/lib.rs":"af8a91215b975e94cfff7282d948ed74236c1cb10ad047df583ea1b01e2fe4cd"},"package":"398f9ad7239db44fd0f80fe068d12ff22d78354080332a5077dc6f52f14dcf2f"}
\ No newline at end of file diff --git a/vendor/unic-langid/Cargo.toml b/vendor/unic-langid/Cargo.toml index 2a07c71aa..745594361 100644 --- a/vendor/unic-langid/Cargo.toml +++ b/vendor/unic-langid/Cargo.toml @@ -3,30 +3,36 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g., crates.io) dependencies +# to registry (e.g., crates.io) dependencies. # -# If you believe there's an error in this file please file an -# issue against the rust-lang/cargo repository. If you're -# editing this file be aware that the upstream Cargo.toml -# will likely look very different (and much more reasonable) +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. [package] edition = "2018" name = "unic-langid" -version = "0.9.0" +version = "0.9.1" authors = ["Zibi Braniecki <gandalf@mozilla.com>"] -include = ["src/**/*", "benches/*.rs", "Cargo.toml", "README.md"] +include = [ + "src/**/*", + "benches/*.rs", + "Cargo.toml", + "README.md", +] description = "API for managing Unicode Language Identifiers" readme = "README.md" categories = ["internationalization"] license = "MIT/Apache-2.0" repository = "https://github.com/zbraniecki/unic-locale" + [dependencies.unic-langid-impl] version = "0.9" [dependencies.unic-langid-macros] version = "0.9" optional = true + [dev-dependencies.unic-langid-macros] version = "0.9" diff --git a/vendor/unic-langid/src/lib.rs b/vendor/unic-langid/src/lib.rs index 8da1c8450..f66fb444a 100644 --- a/vendor/unic-langid/src/lib.rs +++ b/vendor/unic-langid/src/lib.rs @@ -30,13 +30,13 @@ //! //! # Optional features //! -//! ## `langid!` and `langids!` macros +//! ## `langid!`, `langids!`, and `langid_slice!` macros //! //! If `feature = "macros"` is selected, the crate provides a procedural macro //! which allows to construct build-time well-formed language identifiers with zero-cost at runtime. //! //! ``` ignore -//! use unic_langid::{langid, langids, lang, region, script, variant}; +//! use unic_langid::{langid, langid_slice, langids, lang, region, script, variant, LanguageIdentifier}; //! use unic_langid::subtags::{Language, Script, Region, Variant}; //! use std::str::FromStr; //! @@ -52,6 +52,8 @@ //! assert_eq!(lang_ids[1], "en-US"); //! assert_eq!(lang_ids[2], "de"); //! +//! const LANGUAGES: &[LanguageIdentifier] = langid_slice!["en-GB", "fr"]; +//! //! assert_eq!(lang!("pl"), "pl"); //! assert_eq!(lang!("pl"), Language::from_str("pl").unwrap()); //! @@ -112,12 +114,23 @@ pub use unic_langid_macros::{lang, langid, region, script, variant}; #[macro_export] macro_rules! langids { ( $($langid:expr),* ) => { - { - let mut v = vec![]; - $( - v.push(langid!($langid)); - )* - v - } + vec![$( + $crate::langid!($langid), + )*] + }; + ( $($langid:expr,)* ) => { + $crate::langids![$($langid),*] + }; +} +#[cfg(feature = "unic-langid-macros")] +#[macro_export] +macro_rules! langid_slice { + ( $($langid:expr),* ) => { + &[$( + $crate::langid!($langid), + )*] + }; + ( $($langid:expr,)* ) => { + $crate::langid_slice![$($langid),*] }; } |