Struct DataMarkerInfo

struct DataMarkerInfo { ... }

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

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.

Implementations

impl DataMarkerInfo

const fn from_id(id: DataMarkerId) -> Self

See Default::default

fn match_marker(self: 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)
);
fn make_locale(self: Self, locale: LocalePreferences) -> DataLocale

Constructs a DataLocale for this DataMarkerInfo.

impl Clone for DataMarkerInfo

fn clone(self: &Self) -> DataMarkerInfo

impl Copy for DataMarkerInfo

impl Debug for DataMarkerInfo

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl Eq for DataMarkerInfo

impl Freeze for DataMarkerInfo

impl Hash for DataMarkerInfo

fn hash<H: core::hash::Hasher>(self: &Self, state: &mut H)

impl Ord for DataMarkerInfo

fn cmp(self: &Self, other: &Self) -> Ordering

impl PartialEq for DataMarkerInfo

fn eq(self: &Self, other: &DataMarkerInfo) -> bool

impl PartialOrd for DataMarkerInfo

fn partial_cmp(self: &Self, other: &Self) -> Option<Ordering>

impl RefUnwindSafe for DataMarkerInfo

impl Send for DataMarkerInfo

impl StructuralPartialEq for DataMarkerInfo

impl Sync for DataMarkerInfo

impl Unpin for DataMarkerInfo

impl UnsafeUnpin for DataMarkerInfo

impl UnwindSafe for DataMarkerInfo

impl<T> Any for DataMarkerInfo

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for DataMarkerInfo

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for DataMarkerInfo

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for DataMarkerInfo

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> ErasedDestructor for DataMarkerInfo

impl<T> From for DataMarkerInfo

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for DataMarkerInfo

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for DataMarkerInfo

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for DataMarkerInfo

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for DataMarkerInfo

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>