Struct icu_provider::DataMarkerInfo
source · #[non_exhaustive]pub struct DataMarkerInfo {
pub path: DataMarkerPath,
pub attributes_domain: &'static str,
pub is_singleton: 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.path: DataMarkerPath
The human-readable path string ends with @
followed by one or more digits (the version
number). Paths do not contain characters other than ASCII letters and digits, _
, /
.
Useful for reading and writing data to a file system.
attributes_domain: &'static str
TODO
is_singleton: bool
TODO
fallback_config: LocaleFallbackConfig
TODO
Implementations§
source§impl DataMarkerInfo
impl DataMarkerInfo
sourcepub const fn from_path(path: DataMarkerPath) -> Self
pub const fn from_path(path: DataMarkerPath) -> 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::prelude::*;
use icu_provider::hello_world::*;
assert!(matches!(HelloWorldV1Marker::INFO.match_marker(HelloWorldV1Marker::INFO), Ok(())));
assert!(matches!(
HelloWorldV1Marker::INFO.match_marker(DummyMarker::INFO),
Err(DataError {
kind: DataErrorKind::MarkerNotFound,
..
})
));
// The error context contains the argument:
assert_eq!(HelloWorldV1Marker::INFO.match_marker(DummyMarker::INFO).unwrap_err().marker_path, Some(DummyMarker::INFO.path));
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 moresource§impl Debug for DataMarkerInfo
impl Debug for DataMarkerInfo
source§impl Hash for DataMarkerInfo
impl Hash for DataMarkerInfo
source§impl Ord for DataMarkerInfo
impl Ord for DataMarkerInfo
source§impl PartialEq for DataMarkerInfo
impl PartialEq for DataMarkerInfo
source§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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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