Struct DataMarkerInfo
#[non_exhaustive]pub struct DataMarkerInfo {
pub id: DataMarkerId,
pub is_singleton: bool,
pub has_checksum: bool,
pub fallback_config: LocaleFallbackConfig,
pub attributes_domain: &'static str,
}
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: DataMarkerId
The ID of this marker.
is_singleton: bool
Whether this data marker only has a single payload, not keyed by a data identifier.
has_checksum: bool
Whether this data marker uses checksums for integrity purposes.
fallback_config: LocaleFallbackConfig
The fallback to use for this data marker.
attributes_domain: &'static str
The attributes domain for this data marker. This can be used for filtering marker attributes during provider export.
Implementations§
§impl DataMarkerInfo
impl DataMarkerInfo
pub const fn from_id(id: DataMarkerId) -> DataMarkerInfo
pub const fn from_id(id: DataMarkerId) -> DataMarkerInfo
See Default::default
pub fn match_marker(self, marker: DataMarkerInfo) -> Result<(), DataError>
pub fn match_marker(self, marker: DataMarkerInfo) -> 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)
);
pub fn make_locale(self, locale: LocalePreferences) -> DataLocale
pub fn make_locale(self, locale: LocalePreferences) -> DataLocale
Constructs a DataLocale
for this DataMarkerInfo
.
Trait Implementations§
§impl Clone for DataMarkerInfo
impl Clone for DataMarkerInfo
§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§impl Debug for DataMarkerInfo
impl Debug for DataMarkerInfo
§impl Hash for DataMarkerInfo
impl Hash for DataMarkerInfo
§impl Ord for DataMarkerInfo
impl Ord for DataMarkerInfo
§impl PartialEq for DataMarkerInfo
impl PartialEq for DataMarkerInfo
§impl PartialOrd for DataMarkerInfo
impl PartialOrd for DataMarkerInfo
impl Copy for DataMarkerInfo
impl Eq for DataMarkerInfo
impl StructuralPartialEq for DataMarkerInfo
Auto Trait Implementations§
impl Freeze for DataMarkerInfo
impl RefUnwindSafe for DataMarkerInfo
impl Send for DataMarkerInfo
impl Sync for DataMarkerInfo
impl Unpin for DataMarkerInfo
impl UnwindSafe for DataMarkerInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more