Struct icu_provider::prelude::DataRequest [−][src]
pub struct DataRequest { pub resource_path: ResourcePath, }
A struct to request a certain piece of data from a data provider.
Fields
resource_path: ResourcePath
Implementations
impl DataRequest
[src]
impl DataRequest
[src]pub fn try_langid(&self) -> Result<&LanguageIdentifier, Error>
[src]
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
impl Clone for DataRequest
[src]
impl Clone for DataRequest
[src]fn clone(&self) -> DataRequest
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl From<DataRequest> for Error
[src]
impl From<DataRequest> for Error
[src]fn from(req: DataRequest) -> Self
[src]
impl From<ResourceKey> for DataRequest
[src]
impl From<ResourceKey> for DataRequest
[src]Create a DataRequest
to a particular ResourceKey
with default options.
fn from(key: ResourceKey) -> Self
[src]
impl PartialEq<DataRequest> for DataRequest
[src]
impl PartialEq<DataRequest> for DataRequest
[src]fn eq(&self, other: &DataRequest) -> bool
[src]
fn ne(&self, other: &DataRequest) -> bool
[src]
impl StructuralPartialEq for DataRequest
[src]
impl StructuralPartialEq for DataRequest
[src]Auto Trait Implementations
impl RefUnwindSafe for DataRequest
impl RefUnwindSafe for DataRequest
impl Send for DataRequest
impl Send for DataRequest
impl Sync for DataRequest
impl Sync for DataRequest
impl Unpin for DataRequest
impl Unpin for DataRequest
impl UnwindSafe for DataRequest
impl UnwindSafe for DataRequest