#[non_exhaustive]pub struct DataMarkerInfo {
pub id: DataMarkerId,
pub is_singleton: bool,
pub has_checksum: bool,
pub fallback_config: LocaleFallbackConfig,
}Expand description
Used for loading data from a dynamic ICU4X data provider.
A data marker is tightly coupled with the code that uses it to load data at runtime.
Executables can be searched for DataMarkerInfo instances to produce optimized data files.
Therefore, users should not generally create DataMarkerInfo instances; they should instead use
the ones exported by a component.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: DataMarkerIdThe ID of this marker.
is_singleton: boolWhether this data marker only has a single payload, not keyed by a data identifier.
has_checksum: boolWhether this data marker uses checksums for integrity purposes.
fallback_config: LocaleFallbackConfigThe fallback to use for this data marker.
Implementations§
Source§impl DataMarkerInfo
impl DataMarkerInfo
Sourcepub const fn from_id(id: DataMarkerId) -> Self
pub const fn from_id(id: DataMarkerId) -> Self
See Default::default
Sourcepub fn match_marker(self, marker: Self) -> Result<(), DataError>
pub fn match_marker(self, marker: Self) -> Result<(), DataError>
Returns Ok if this data marker matches the argument, or the appropriate error.
Convenience method for data providers that support a single DataMarkerInfo.
§Examples
use icu_provider::hello_world::*;
use icu_provider::prelude::*;
icu_provider::data_marker!(
DummyV1,
<HelloWorldV1 as DynamicDataMarker>::DataStruct
);
assert!(matches!(
HelloWorldV1::INFO.match_marker(HelloWorldV1::INFO),
Ok(())
));
assert!(matches!(
HelloWorldV1::INFO.match_marker(DummyV1::INFO),
Err(DataError {
kind: DataErrorKind::MarkerNotFound,
..
})
));
// The error context contains the argument:
assert_eq!(
HelloWorldV1::INFO
.match_marker(DummyV1::INFO)
.unwrap_err()
.marker,
Some(DummyV1::INFO.id)
);Sourcepub fn make_locale(self, locale: LocalePreferences) -> DataLocale
pub fn make_locale(self, locale: LocalePreferences) -> DataLocale
Constructs a DataLocale for this DataMarkerInfo.
Trait Implementations§
Source§impl Clone for DataMarkerInfo
impl Clone for DataMarkerInfo
Source§fn clone(&self) -> DataMarkerInfo
fn clone(&self) -> DataMarkerInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more