Debian Codegraph @

intl/icu_capi/src/locale.rs

raw symbols SCIP
1 // This file is part of ICU4X. For terms of use, please see the file
2 // called LICENSE at the top level of the ICU4X source tree
3 // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
4
5 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::bridgerust-analyzer cargo diplomat 0.8.0 bridge:]
6 pub mod ffirust-analyzer cargo icu_capi 1.5.0 locale/ffi/ {
7 use craterust-analyzer cargo icu_capi 1.5.0 crate/::errorsrust-analyzer cargo icu_capi 1.5.0 errors/::ffirust-analyzer cargo icu_capi 1.5.0 errors/ffi/::ICU4XErrorrust-analyzer cargo icu_capi 1.5.0 errors/ffi/ICU4XError#;
8 use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::boxedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/::Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#;
9 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/;
10 use icu_locidrust-analyzer cargo icu_locid 1.5.0 crate/::extensionsrust-analyzer cargo icu_locid 1.5.0 extensions/::unicoderust-analyzer cargo icu_locid 1.5.0 extensions/unicode/::Keyrust-analyzer cargo icu_locid 1.5.0 extensions/unicode/key/Key#;
11 use icu_locidrust-analyzer cargo icu_locid 1.5.0 crate/::subtagsrust-analyzer cargo icu_locid 1.5.0 subtags/::{Languagerust-analyzer cargo icu_locid 1.5.0 subtags/language/Language#, Regionrust-analyzer cargo icu_locid 1.5.0 subtags/region/Region#, Scriptrust-analyzer cargo icu_locid 1.5.0 subtags/script/Script#};
12 use icu_locidrust-analyzer cargo icu_locid 1.5.0 crate/::Localerust-analyzer cargo icu_locid 1.5.0 locale/Locale#;
13 use writeablerust-analyzer cargo writeable 0.5.5 crate/::Writeablerust-analyzer cargo writeable 0.5.5 Writeable#;
14
15 use craterust-analyzer cargo icu_capi 1.5.0 crate/::commonrust-analyzer cargo icu_capi 1.5.0 common/::ffirust-analyzer cargo icu_capi 1.5.0 common/ffi/::ICU4XOrderingrust-analyzer cargo icu_capi 1.5.0 common/ffi/ICU4XOrdering#;
16
17 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::opaque]
18 /// An ICU4X Locale, capable of representing strings like `"en-US"`.
19 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::rust_link(icu::locid::Locale, Struct)]
20 pub struct ICU4XLocalerust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#(pub Localerust-analyzer cargo icu_locid 1.5.0 locale/Locale#);
21
22 impl ICU4XLocalerust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale# {
23 /// Construct an [`ICU4XLocale`] from an locale identifier.
24 ///
25 /// This will run the complete locale parsing algorithm. If code size and
26 /// performance are critical and the locale is of a known shape (such as
27 /// `aa-BB`) use `create_und`, `set_language`, `set_script`, and `set_region`.
28 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::rust_link(icu::locid::Locale::try_from_bytes, FnInStruct)]
29 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::rust_link(icu::locid::Locale::from_str, FnInStruct, hidden)]
30 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::attr(all(supports = constructors, supports = fallible_constructors, supports = named_constructors), named_constructor = "from_string")]
31 pub fn create_from_stringrust-analyzer cargo icu_capi 1.5.0 locale/ffi/impl#[ICU4XLocale]create_from_string().(name: &DiplomatStrrust-analyzer cargo diplomat-runtime 0.8.0 DiplomatStr#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<ICU4XLocalerust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#>, ICU4XErrorrust-analyzer cargo icu_capi 1.5.0 errors/ffi/ICU4XError#> {
32 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(ICU4XLocalerust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#(Localerust-analyzer cargo icu_locid 1.5.0 locale/Locale#::try_from_bytesrust-analyzer cargo icu_locid 1.5.0 locale/impl#[Locale]try_from_bytes().(name)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)))
33 }
34
35 /// Construct a default undefined [`ICU4XLocale`] "und".
36 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::rust_link(icu::locid::Locale::UND, AssociatedConstantInStruct)]
37 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::attr(all(supports = constructors, supports = fallible_constructors, supports = named_constructors), named_constructor = "und")]
38 pub fn create_undrust-analyzer cargo icu_capi 1.5.0 locale/ffi/impl#[ICU4XLocale]create_und().() -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<ICU4XLocalerust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#> {
39 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(ICU4XLocalerust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#(Localerust-analyzer cargo icu_locid 1.5.0 locale/Locale#::UNDrust-analyzer cargo icu_locid 1.5.0 locale/impl#[Locale]UND.))
40 }
41
42 /// Clones the [`ICU4XLocale`].
43 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::rust_link(icu::locid::Locale, Struct)]
44 pub fn clonerust-analyzer cargo icu_capi 1.5.0 locale/ffi/impl#[ICU4XLocale]clone().(&self) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<ICU4XLocalerust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#> {
45 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(ICU4XLocalerust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#(self.0rust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#0..clonerust-analyzer cargo icu_locid 1.5.0 locale/impl#[Locale][Clone]clone().()))
46 }
47
48 /// Write a string representation of the `LanguageIdentifier` part of
49 /// [`ICU4XLocale`] to `write`.
50 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::rust_link(icu::locid::Locale::id, StructField)]
51 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::attr(supports = accessors, getter)]
52 pub fn basenamerust-analyzer cargo icu_capi 1.5.0 locale/ffi/impl#[ICU4XLocale]basename().(
53 &self,
54 write: &mut diplomat_runtimerust-analyzer cargo diplomat-runtime 0.8.0 crate/::DiplomatWriteablerust-analyzer cargo diplomat-runtime 0.8.0 writeable/DiplomatWriteable#,
55 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), ICU4XErrorrust-analyzer cargo icu_capi 1.5.0 errors/ffi/ICU4XError#> {
56 self.0rust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#0..idrust-analyzer cargo icu_locid 1.5.0 locale/Locale#id..write_torust-analyzer cargo icu_locid 1.5.0 langid/impl#[LanguageIdentifier][Writeable]write_to().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
57 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
58 }
59
60 /// Write a string representation of the unicode extension to `write`
61 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::rust_link(icu::locid::Locale::extensions, StructField)]
62 pub fn get_unicode_extensionrust-analyzer cargo icu_capi 1.5.0 locale/ffi/impl#[ICU4XLocale]get_unicode_extension().(
63 &self,
64 bytes: &DiplomatStrrust-analyzer cargo diplomat-runtime 0.8.0 DiplomatStr#,
65 write: &mut diplomat_runtimerust-analyzer cargo diplomat-runtime 0.8.0 crate/::DiplomatWriteablerust-analyzer cargo diplomat-runtime 0.8.0 writeable/DiplomatWriteable#,
66 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), ICU4XErrorrust-analyzer cargo icu_capi 1.5.0 errors/ffi/ICU4XError#> {
67 self.0rust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#0.
68 .extensionsrust-analyzer cargo icu_locid 1.5.0 locale/Locale#extensions.
69 .unicoderust-analyzer cargo icu_locid 1.5.0 extensions/Extensions#unicode.
70 .keywordsrust-analyzer cargo icu_locid 1.5.0 extensions/unicode/Unicode#keywords.
71 .getrust-analyzer cargo icu_locid 1.5.0 extensions/unicode/keywords/impl#[Keywords]get().(&Keyrust-analyzer cargo icu_locid 1.5.0 extensions/unicode/key/Key#::try_from_bytesrust-analyzer cargo icu_locid 1.5.0 extensions/unicode/key/impl#[Key]try_from_bytes().(bytes)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)
72 .ok_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or().(ICU4XErrorrust-analyzer cargo icu_capi 1.5.0 errors/ffi/ICU4XError#::LocaleUndefinedSubtagErrorrust-analyzer cargo icu_capi 1.5.0 errors/ffi/ICU4XError#LocaleUndefinedSubtagError#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
73 .write_torust-analyzer cargo icu_locid 1.5.0 extensions/unicode/value/impl#[Value][Writeable]write_to().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
74 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
75 }
76
77 /// Write a string representation of [`ICU4XLocale`] language to `write`
78 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::rust_link(icu::locid::Locale::id, StructField)]
79 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::attr(supports = accessors, getter)]
80 pub fn languagerust-analyzer cargo icu_capi 1.5.0 locale/ffi/impl#[ICU4XLocale]language().(
81 &self,
82 write: &mut diplomat_runtimerust-analyzer cargo diplomat-runtime 0.8.0 crate/::DiplomatWriteablerust-analyzer cargo diplomat-runtime 0.8.0 writeable/DiplomatWriteable#,
83 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), ICU4XErrorrust-analyzer cargo icu_capi 1.5.0 errors/ffi/ICU4XError#> {
84 self.0rust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#0..idrust-analyzer cargo icu_locid 1.5.0 locale/Locale#id..languagerust-analyzer cargo icu_locid 1.5.0 langid/LanguageIdentifier#language..write_torust-analyzer cargo icu_locid 1.5.0 subtags/language/impl#[Language][Writeable]write_to().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
85 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
86 }
87
88 /// Set the language part of the [`ICU4XLocale`].
89 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::rust_link(icu::locid::Locale::try_from_bytes, FnInStruct)]
90 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::attr(supports = accessors, setter = "language")]
91 pub fn set_languagerust-analyzer cargo icu_capi 1.5.0 locale/ffi/impl#[ICU4XLocale]set_language().(&mut self, bytes: &DiplomatStrrust-analyzer cargo diplomat-runtime 0.8.0 DiplomatStr#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), ICU4XErrorrust-analyzer cargo icu_capi 1.5.0 errors/ffi/ICU4XError#> {
92 self.0rust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#0..idrust-analyzer cargo icu_locid 1.5.0 locale/Locale#id..languagerust-analyzer cargo icu_locid 1.5.0 langid/LanguageIdentifier#language. = if bytes.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() {
93 Languagerust-analyzer cargo icu_locid 1.5.0 subtags/language/Language#::UNDrust-analyzer cargo icu_locid 1.5.0 subtags/language/impl#[Language]UND.
94 } else {
95 Languagerust-analyzer cargo icu_locid 1.5.0 subtags/language/Language#::try_from_bytesrust-analyzer cargo icu_locid 1.5.0 subtags/language/impl#[Language]try_from_bytes().(bytes)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
96 };
97 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
98 }
99
100 /// Write a string representation of [`ICU4XLocale`] region to `write`
101 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::rust_link(icu::locid::Locale::id, StructField)]
102 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::attr(supports = accessors, getter)]
103 pub fn regionrust-analyzer cargo icu_capi 1.5.0 locale/ffi/impl#[ICU4XLocale]region().(
104 &self,
105 write: &mut diplomat_runtimerust-analyzer cargo diplomat-runtime 0.8.0 crate/::DiplomatWriteablerust-analyzer cargo diplomat-runtime 0.8.0 writeable/DiplomatWriteable#,
106 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), ICU4XErrorrust-analyzer cargo icu_capi 1.5.0 errors/ffi/ICU4XError#> {
107 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(region) = self.0rust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#0..idrust-analyzer cargo icu_locid 1.5.0 locale/Locale#id..regionrust-analyzer cargo icu_locid 1.5.0 langid/LanguageIdentifier#region. {
108 region.write_torust-analyzer cargo icu_locid 1.5.0 subtags/region/impl#[Region][Writeable]write_to().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
109 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
110 } else {
111 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ICU4XErrorrust-analyzer cargo icu_capi 1.5.0 errors/ffi/ICU4XError#::LocaleUndefinedSubtagErrorrust-analyzer cargo icu_capi 1.5.0 errors/ffi/ICU4XError#LocaleUndefinedSubtagError#)
112 }
113 }
114
115 /// Set the region part of the [`ICU4XLocale`].
116 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::rust_link(icu::locid::Locale::try_from_bytes, FnInStruct)]
117 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::attr(supports = accessors, setter = "region")]
118 pub fn set_regionrust-analyzer cargo icu_capi 1.5.0 locale/ffi/impl#[ICU4XLocale]set_region().(&mut self, bytes: &DiplomatStrrust-analyzer cargo diplomat-runtime 0.8.0 DiplomatStr#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), ICU4XErrorrust-analyzer cargo icu_capi 1.5.0 errors/ffi/ICU4XError#> {
119 self.0rust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#0..idrust-analyzer cargo icu_locid 1.5.0 locale/Locale#id..regionrust-analyzer cargo icu_locid 1.5.0 langid/LanguageIdentifier#region. = if bytes.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() {
120 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
121 } else {
122 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Regionrust-analyzer cargo icu_locid 1.5.0 subtags/region/Region#::try_from_bytesrust-analyzer cargo icu_locid 1.5.0 subtags/region/impl#[Region]try_from_bytes().(bytes)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)
123 };
124 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
125 }
126
127 /// Write a string representation of [`ICU4XLocale`] script to `write`
128 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::rust_link(icu::locid::Locale::id, StructField)]
129 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::attr(supports = accessors, getter)]
130 pub fn scriptrust-analyzer cargo icu_capi 1.5.0 locale/ffi/impl#[ICU4XLocale]script().(
131 &self,
132 write: &mut diplomat_runtimerust-analyzer cargo diplomat-runtime 0.8.0 crate/::DiplomatWriteablerust-analyzer cargo diplomat-runtime 0.8.0 writeable/DiplomatWriteable#,
133 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), ICU4XErrorrust-analyzer cargo icu_capi 1.5.0 errors/ffi/ICU4XError#> {
134 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(script) = self.0rust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#0..idrust-analyzer cargo icu_locid 1.5.0 locale/Locale#id..scriptrust-analyzer cargo icu_locid 1.5.0 langid/LanguageIdentifier#script. {
135 script.write_torust-analyzer cargo icu_locid 1.5.0 subtags/script/impl#[Script][Writeable]write_to().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
136 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
137 } else {
138 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ICU4XErrorrust-analyzer cargo icu_capi 1.5.0 errors/ffi/ICU4XError#::LocaleUndefinedSubtagErrorrust-analyzer cargo icu_capi 1.5.0 errors/ffi/ICU4XError#LocaleUndefinedSubtagError#)
139 }
140 }
141
142 /// Set the script part of the [`ICU4XLocale`]. Pass an empty string to remove the script.
143 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::rust_link(icu::locid::Locale::try_from_bytes, FnInStruct)]
144 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::attr(supports = accessors, setter = "script")]
145 pub fn set_scriptrust-analyzer cargo icu_capi 1.5.0 locale/ffi/impl#[ICU4XLocale]set_script().(&mut self, bytes: &DiplomatStrrust-analyzer cargo diplomat-runtime 0.8.0 DiplomatStr#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), ICU4XErrorrust-analyzer cargo icu_capi 1.5.0 errors/ffi/ICU4XError#> {
146 self.0rust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#0..idrust-analyzer cargo icu_locid 1.5.0 locale/Locale#id..scriptrust-analyzer cargo icu_locid 1.5.0 langid/LanguageIdentifier#script. = if bytes.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() {
147 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
148 } else {
149 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Scriptrust-analyzer cargo icu_locid 1.5.0 subtags/script/Script#::try_from_bytesrust-analyzer cargo icu_locid 1.5.0 subtags/script/impl#[Script]try_from_bytes().(bytes)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)
150 };
151 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
152 }
153
154 /// Best effort locale canonicalizer that doesn't need any data
155 ///
156 /// Use ICU4XLocaleCanonicalizer for better control and functionality
157 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::rust_link(icu::locid::Locale::canonicalize, FnInStruct)]
158 pub fn canonicalizerust-analyzer cargo icu_capi 1.5.0 locale/ffi/impl#[ICU4XLocale]canonicalize().(
159 bytes: &DiplomatStrrust-analyzer cargo diplomat-runtime 0.8.0 DiplomatStr#,
160 write: &mut DiplomatWriteablerust-analyzer cargo diplomat-runtime 0.8.0 writeable/DiplomatWriteable#,
161 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), ICU4XErrorrust-analyzer cargo icu_capi 1.5.0 errors/ffi/ICU4XError#> {
162 Localerust-analyzer cargo icu_locid 1.5.0 locale/Locale#::canonicalizerust-analyzer cargo icu_locid 1.5.0 locale/impl#[Locale]canonicalize().(bytes)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..write_torust-analyzer cargo writeable 0.5.5 impls/impl#[String][Writeable]write_to().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
163 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
164 }
165 /// Write a string representation of [`ICU4XLocale`] to `write`
166 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::rust_link(icu::locid::Locale::write_to, FnInStruct)]
167 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::attr(supports = stringifiers, stringifier)]
168 pub fn to_stringrust-analyzer cargo icu_capi 1.5.0 locale/ffi/impl#[ICU4XLocale]to_string().(
169 &self,
170 write: &mut diplomat_runtimerust-analyzer cargo diplomat-runtime 0.8.0 crate/::DiplomatWriteablerust-analyzer cargo diplomat-runtime 0.8.0 writeable/DiplomatWriteable#,
171 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), ICU4XErrorrust-analyzer cargo icu_capi 1.5.0 errors/ffi/ICU4XError#> {
172 self.0rust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#0..write_torust-analyzer cargo icu_locid 1.5.0 locale/impl#[Locale][Writeable]write_to().(write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
173 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
174 }
175
176 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::rust_link(icu::locid::Locale::normalizing_eq, FnInStruct)]
177 pub fn normalizing_eqrust-analyzer cargo icu_capi 1.5.0 locale/ffi/impl#[ICU4XLocale]normalizing_eq().(&self, other: &DiplomatStrrust-analyzer cargo diplomat-runtime 0.8.0 DiplomatStr#) -> bool {
178 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(other) = strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/::from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(other) {
179 self.0rust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#0..normalizing_eqrust-analyzer cargo icu_locid 1.5.0 locale/impl#[Locale]normalizing_eq().(other)
180 } else {
181 // invalid UTF8 won't be allowed in locales anyway
182 false
183 }
184 }
185
186 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::rust_link(icu::locid::Locale::strict_cmp, FnInStruct)]
187 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::attr(*, disable)]
188 pub fn strict_cmprust-analyzer cargo icu_capi 1.5.0 locale/ffi/impl#[ICU4XLocale]strict_cmp().(&self, other: &DiplomatStrrust-analyzer cargo diplomat-runtime 0.8.0 DiplomatStr#) -> ICU4XOrderingrust-analyzer cargo icu_capi 1.5.0 common/ffi/ICU4XOrdering# {
189 self.0rust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#0..strict_cmprust-analyzer cargo icu_locid 1.5.0 locale/impl#[Locale]strict_cmp().(other).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
190 }
191
192 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::rust_link(icu::locid::Locale::strict_cmp, FnInStruct)]
193 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::skip_if_ast]
194 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::attr(dart, rename = "compareToString")]
195 pub fn strict_cmp_rust-analyzer cargo icu_capi 1.5.0 locale/ffi/impl#[ICU4XLocale]strict_cmp_().(&self, other: &DiplomatStrrust-analyzer cargo diplomat-runtime 0.8.0 DiplomatStr#) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering# {
196 self.0rust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#0..strict_cmprust-analyzer cargo icu_locid 1.5.0 locale/impl#[Locale]strict_cmp().(other)
197 }
198
199 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::rust_link(icu::locid::Locale::total_cmp, FnInStruct)]
200 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::attr(*, disable)]
201 pub fn total_cmprust-analyzer cargo icu_capi 1.5.0 locale/ffi/impl#[ICU4XLocale]total_cmp().(&self, other: &Selfrust-analyzer cargo icu_capi 1.5.0 locale/ffi/impl#[ICU4XLocale]) -> ICU4XOrderingrust-analyzer cargo icu_capi 1.5.0 common/ffi/ICU4XOrdering# {
202 self.0rust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#0..total_cmprust-analyzer cargo icu_locid 1.5.0 locale/impl#[Locale]total_cmp().(&other.0rust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#0.).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
203 }
204
205 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::rust_link(icu::locid::Locale::total_cmp, FnInStruct)]
206 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::skip_if_ast]
207 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::attr(supports = comparators, comparison)]
208 pub fn total_cmp_rust-analyzer cargo icu_capi 1.5.0 locale/ffi/impl#[ICU4XLocale]total_cmp_().(&self, other: &Selfrust-analyzer cargo icu_capi 1.5.0 locale/ffi/impl#[ICU4XLocale]) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering# {
209 self.0rust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#0..total_cmprust-analyzer cargo icu_locid 1.5.0 locale/impl#[Locale]total_cmp().(&other.0rust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#0.)
210 }
211
212 /// Deprecated
213 ///
214 /// Use `create_from_string("en").
215 #[cfg(feature = "provider_test")]
216 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::attr(supports = constructors, disable)]
217 pub fn create_en() -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<ICU4XLocalerust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#> {
218 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::new(ICU4XLocalerust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#(icu_locidrust-analyzer cargo icu_locid 1.5.0 crate/::localerust-analyzer cargo icu_locid 1.5.0 locale/!("en")))
219 }
220
221 /// Deprecated
222 ///
223 /// Use `create_from_string("bn").
224 #[cfg(feature = "provider_test")]
225 #[diplomatrust-analyzer cargo diplomat 0.8.0 crate/::attr(supports = constructors, disable)]
226 pub fn create_bn() -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<ICU4XLocalerust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#> {
227 Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::new(ICU4XLocalerust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#(icu_locidrust-analyzer cargo icu_locid 1.5.0 crate/::localerust-analyzer cargo icu_locid 1.5.0 locale/!("bn")))
228 }
229 }
230 }
231
232 impl ffirust-analyzer cargo icu_capi 1.5.0 locale/ffi/::ICU4XLocalerust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale# {
233 pub fn to_datalocalerust-analyzer cargo icu_capi 1.5.0 locale/impl#[`ffi::ICU4XLocale`]to_datalocale().(&self) -> icu_providerrust-analyzer cargo icu_provider 1.5.0 crate/::DataLocalerust-analyzer cargo icu_provider 1.5.0 request/DataLocale# {
234 (&self.0rust-analyzer cargo icu_capi 1.5.0 locale/ffi/ICU4XLocale#0.).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
235 }
236 }