Struct icu_provider::prelude::DataRequest [−][src]
pub struct DataRequest { pub resource_path: ResourcePath, }
Expand description
A struct to request a certain piece of data from a data provider.
Fields
resource_path: ResourcePath
Implementations
Returns the LanguageIdentifier
for this DataRequest
, or an error if it is not present.
Examples
use icu_provider::prelude::*; const FOO_BAR: ResourceKey = icu_provider::resource_key!(x, "foo", "bar", 1); let req_no_langid = DataRequest { resource_path: ResourcePath { key: FOO_BAR, options: ResourceOptions::default(), } }; let req_with_langid = DataRequest { resource_path: ResourcePath { key: FOO_BAR, options: ResourceOptions { variant: None, langid: Some(icu_locid_macros::langid!("ar-EG")), }, } }; assert!(matches!(req_no_langid.try_langid(), Err(DataError::NeedsLanguageIdentifier(_)))); assert!(matches!(req_with_langid.try_langid(), Ok(_)));
Trait Implementations
Performs the conversion.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for DataRequest
impl Send for DataRequest
impl Sync for DataRequest
impl Unpin for DataRequest
impl UnwindSafe for DataRequest
Blanket Implementations
Mutably borrows from an owned value. Read more
Clone this trait object reference, returning a boxed trait object.