diff options
Diffstat (limited to 'vendor/icu_locid/src/extensions')
-rw-r--r-- | vendor/icu_locid/src/extensions/mod.rs | 2 | ||||
-rw-r--r-- | vendor/icu_locid/src/extensions/unicode/keywords.rs | 14 | ||||
-rw-r--r-- | vendor/icu_locid/src/extensions/unicode/value.rs | 12 |
3 files changed, 14 insertions, 14 deletions
diff --git a/vendor/icu_locid/src/extensions/mod.rs b/vendor/icu_locid/src/extensions/mod.rs index a6a189b11..5f1ad2b1f 100644 --- a/vendor/icu_locid/src/extensions/mod.rs +++ b/vendor/icu_locid/src/extensions/mod.rs @@ -214,7 +214,7 @@ impl Extensions { if subtag.is_empty() { return Err(ParserError::InvalidExtension); } - match subtag.get(0).map(|b| ExtensionType::try_from_byte(*b)) { + match subtag.first().map(|b| ExtensionType::try_from_byte(*b)) { Some(Ok(ExtensionType::Unicode)) => { if unicode.is_some() { return Err(ParserError::DuplicatedExtension); diff --git a/vendor/icu_locid/src/extensions/unicode/keywords.rs b/vendor/icu_locid/src/extensions/unicode/keywords.rs index 580cacaf1..4e2fbae9a 100644 --- a/vendor/icu_locid/src/extensions/unicode/keywords.rs +++ b/vendor/icu_locid/src/extensions/unicode/keywords.rs @@ -9,7 +9,7 @@ use litemap::LiteMap; use super::Key; use super::Value; -use crate::helpers::ShortVec; +use crate::helpers::ShortSlice; use crate::ordering::SubtagOrderingResult; /// A list of [`Key`]-[`Value`] pairs representing functional information @@ -66,7 +66,7 @@ use crate::ordering::SubtagOrderingResult; /// /// [`Locale`]: crate::Locale #[derive(Clone, PartialEq, Eq, Debug, Default, Hash, PartialOrd, Ord)] -pub struct Keywords(LiteMap<Key, Value, ShortVec<(Key, Value)>>); +pub struct Keywords(LiteMap<Key, Value, ShortSlice<(Key, Value)>>); impl Keywords { /// Returns a new empty list of key-value pairs. Same as [`default()`](Default::default()), but is `const`. @@ -86,9 +86,9 @@ impl Keywords { /// Create a new list of key-value pairs having exactly one pair, callable in a `const` context. #[inline] pub const fn new_single(key: Key, value: Value) -> Self { - Self(LiteMap::from_sorted_store_unchecked(ShortVec::new_single( - (key, value), - ))) + Self(LiteMap::from_sorted_store_unchecked( + ShortSlice::new_single((key, value)), + )) } /// Returns `true` if there are no keywords. @@ -390,8 +390,8 @@ impl Keywords { } } -impl From<LiteMap<Key, Value, ShortVec<(Key, Value)>>> for Keywords { - fn from(map: LiteMap<Key, Value, ShortVec<(Key, Value)>>) -> Self { +impl From<LiteMap<Key, Value, ShortSlice<(Key, Value)>>> for Keywords { + fn from(map: LiteMap<Key, Value, ShortSlice<(Key, Value)>>) -> Self { Self(map) } } diff --git a/vendor/icu_locid/src/extensions/unicode/value.rs b/vendor/icu_locid/src/extensions/unicode/value.rs index e6374372c..f1b2402de 100644 --- a/vendor/icu_locid/src/extensions/unicode/value.rs +++ b/vendor/icu_locid/src/extensions/unicode/value.rs @@ -2,7 +2,7 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -use crate::helpers::ShortVec; +use crate::helpers::ShortSlice; use crate::parser::{ParserError, SubtagIterator}; use alloc::vec::Vec; use core::ops::RangeInclusive; @@ -35,7 +35,7 @@ use tinystr::TinyAsciiStr; /// assert_eq!(value!("true").to_string(), ""); /// ``` #[derive(Debug, PartialEq, Eq, Clone, Hash, PartialOrd, Ord, Default)] -pub struct Value(ShortVec<TinyAsciiStr<{ *VALUE_LENGTH.end() }>>); +pub struct Value(ShortSlice<TinyAsciiStr<{ *VALUE_LENGTH.end() }>>); const VALUE_LENGTH: RangeInclusive<usize> = 3..=8; const TRUE_VALUE: TinyAsciiStr<8> = tinystr::tinystr!(8, "true"); @@ -52,7 +52,7 @@ impl Value { /// Value::try_from_bytes(b"buddhist").expect("Parsing failed."); /// ``` pub fn try_from_bytes(input: &[u8]) -> Result<Self, ParserError> { - let mut v = ShortVec::new(); + let mut v = Vec::new(); if !input.is_empty() { for subtag in SubtagIterator::new(input) { @@ -62,7 +62,7 @@ impl Value { } } } - Ok(Self(v)) + Ok(Self(v.into())) } /// Const constructor for when the value contains only a single subtag. @@ -96,11 +96,11 @@ impl Value { #[doc(hidden)] pub const fn from_tinystr(subtag: Option<TinyAsciiStr<8>>) -> Self { match subtag { - None => Self(ShortVec::new()), + None => Self(ShortSlice::new()), Some(val) => { debug_assert!(val.is_ascii_alphanumeric()); debug_assert!(!matches!(val, TRUE_VALUE)); - Self(ShortVec::new_single(val)) + Self(ShortSlice::new_single(val)) } } } |