Commit e826a2e 1 parent 2582efb commit e826a2e Copy full SHA for e826a2e
File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -916,6 +916,25 @@ impl AuxiliaryKeys {
916
916
}
917
917
}
918
918
919
+ /// Creates an [`AuxiliaryKeys`] from a single subtag.
920
+ ///
921
+ /// # Examples
922
+ ///
923
+ /// ```
924
+ /// use icu_provider::prelude::*;
925
+ /// use icu_locid::extensions::private::subtag;
926
+ ///
927
+ /// // Single auxiliary key:
928
+ /// let a = AuxiliaryKeys::from_subtag(subtag!("abc"));
929
+ /// let b = "abc".parse::<AuxiliaryKeys>().unwrap();
930
+ /// assert_eq!(a, b);
931
+ /// ```
932
+ pub const fn from_subtag ( input : Subtag ) -> Self {
933
+ Self {
934
+ value : AuxiliaryKeysInner :: Stack ( input. into_tinystr ( ) . resize ( ) ) ,
935
+ }
936
+ }
937
+
919
938
pub ( crate ) fn try_from_str ( s : & str ) -> Result < Self , DataError > {
920
939
if !s. is_empty ( )
921
940
&& s. split ( Self :: separator ( ) ) . all ( |b| {
You can’t perform that action at this time.
0 commit comments