summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_baked_icu_data/src/data/any.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:25 +0000
commit5363f350887b1e5b5dd21a86f88c8af9d7fea6da (patch)
tree35ca005eb6e0e9a1ba3bb5dbc033209ad445dc17 /compiler/rustc_baked_icu_data/src/data/any.rs
parentAdding debian version 1.66.0+dfsg1-1. (diff)
downloadrustc-5363f350887b1e5b5dd21a86f88c8af9d7fea6da.tar.xz
rustc-5363f350887b1e5b5dd21a86f88c8af9d7fea6da.zip
Merging upstream version 1.67.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_baked_icu_data/src/data/any.rs')
-rw-r--r--compiler/rustc_baked_icu_data/src/data/any.rs42
1 files changed, 42 insertions, 0 deletions
diff --git a/compiler/rustc_baked_icu_data/src/data/any.rs b/compiler/rustc_baked_icu_data/src/data/any.rs
new file mode 100644
index 000000000..e8e99be93
--- /dev/null
+++ b/compiler/rustc_baked_icu_data/src/data/any.rs
@@ -0,0 +1,42 @@
+// @generated
+impl AnyProvider for BakedDataProvider {
+ fn load_any(&self, key: DataKey, req: DataRequest) -> Result<AnyResponse, DataError> {
+ const ANDLISTV1MARKER: ::icu_provider::DataKeyHash =
+ ::icu_list::provider::AndListV1Marker::KEY.hashed();
+ const COLLATIONFALLBACKSUPPLEMENTV1MARKER: ::icu_provider::DataKeyHash =
+ ::icu_provider_adapters::fallback::provider::CollationFallbackSupplementV1Marker::KEY
+ .hashed();
+ const LOCALEFALLBACKLIKELYSUBTAGSV1MARKER: ::icu_provider::DataKeyHash =
+ ::icu_provider_adapters::fallback::provider::LocaleFallbackLikelySubtagsV1Marker::KEY
+ .hashed();
+ const LOCALEFALLBACKPARENTSV1MARKER: ::icu_provider::DataKeyHash =
+ ::icu_provider_adapters::fallback::provider::LocaleFallbackParentsV1Marker::KEY
+ .hashed();
+ #[allow(clippy::match_single_binding)]
+ match key.hashed() {
+ ANDLISTV1MARKER => list::and_v1::DATA
+ .get_by(|k| req.locale.strict_cmp(k.as_bytes()).reverse())
+ .copied()
+ .map(AnyPayload::from_static_ref)
+ .ok_or(DataErrorKind::MissingLocale),
+ COLLATIONFALLBACKSUPPLEMENTV1MARKER => fallback::supplement::co_v1::DATA
+ .get_by(|k| req.locale.strict_cmp(k.as_bytes()).reverse())
+ .copied()
+ .map(AnyPayload::from_static_ref)
+ .ok_or(DataErrorKind::MissingLocale),
+ LOCALEFALLBACKLIKELYSUBTAGSV1MARKER => fallback::likelysubtags_v1::DATA
+ .get_by(|k| req.locale.strict_cmp(k.as_bytes()).reverse())
+ .copied()
+ .map(AnyPayload::from_static_ref)
+ .ok_or(DataErrorKind::MissingLocale),
+ LOCALEFALLBACKPARENTSV1MARKER => fallback::parents_v1::DATA
+ .get_by(|k| req.locale.strict_cmp(k.as_bytes()).reverse())
+ .copied()
+ .map(AnyPayload::from_static_ref)
+ .ok_or(DataErrorKind::MissingLocale),
+ _ => Err(DataErrorKind::MissingDataKey),
+ }
+ .map_err(|e| e.with_req(key, req))
+ .map(|payload| AnyResponse { payload: Some(payload), metadata: Default::default() })
+ }
+}