pub struct DataProvider(/* private fields */);
Expand description
An ICU4X data provider, capable of loading ICU4X data keys from some source.
Currently the only source supported is loading from “blob” formatted data from a bytes buffer or the file system.
If you wish to use ICU4X’s builtin “compiled data”, use the version of the constructors that do not have _with_provider
in their names.
Implementations§
Source§impl DataProvider
impl DataProvider
Sourcepub fn from_fs(path: &DiplomatStr) -> Result<Box<DataProvider>, DataError>
pub fn from_fs(path: &DiplomatStr) -> Result<Box<DataProvider>, DataError>
Constructs an FsDataProvider
and returns it as an DataProvider
.
Requires the provider_fs
Cargo feature.
Not supported in WASM.
Sourcepub fn from_byte_slice(
blob: &'static [DiplomatByte],
) -> Result<Box<DataProvider>, DataError>
pub fn from_byte_slice( blob: &'static [DiplomatByte], ) -> Result<Box<DataProvider>, DataError>
Constructs a BlobDataProvider
and returns it as an DataProvider
.
Sourcepub fn fork_by_key(&mut self, other: &mut DataProvider) -> Result<(), DataError>
pub fn fork_by_key(&mut self, other: &mut DataProvider) -> Result<(), DataError>
Creates a provider that tries the current provider and then, if the current provider
doesn’t support the data key, another provider other
.
This takes ownership of the other
provider, leaving an empty provider in its place.
Sourcepub fn fork_by_locale(
&mut self,
other: &mut DataProvider,
) -> Result<(), DataError>
pub fn fork_by_locale( &mut self, other: &mut DataProvider, ) -> Result<(), DataError>
Same as fork_by_key
but forks by locale instead of key.
pub fn enable_locale_fallback_with( &mut self, fallbacker: &LocaleFallbacker, ) -> Result<(), DataError>
Auto Trait Implementations§
impl Freeze for DataProvider
impl !RefUnwindSafe for DataProvider
impl !Send for DataProvider
impl !Sync for DataProvider
impl Unpin for DataProvider
impl !UnwindSafe for DataProvider
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> 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