Struct icu_provider::prelude::DataError
source · [−]#[non_exhaustive]pub struct DataError {
pub kind: DataErrorKind,
pub key: Option<ResourceKey>,
pub str_context: Option<&'static str>,
}
Expand description
The error type for ICU4X data provider operations.
To create one of these, either start with a DataErrorKind
or use DataError::custom()
.
Example
Create a NeedsVariant error and attach a data request for context:
let req: &DataRequest = unimplemented!();
DataErrorKind::NeedsVariant.with_req(req);
Create a named custom error:
DataError::custom("This is an example error");
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.kind: DataErrorKind
Broad category of the error.
key: Option<ResourceKey>
The data key of the request, if available.
str_context: Option<&'static str>
Additional context, if available.
Implementations
Returns a new, empty DataError with kind Custom and a string error message.
Sets the resource key of a DataError, returning a modified error.
Sets the string context of a DataError, returning a modified error.
Sets the string context of a DataError to the given type name, returning a modified error.
Logs the data error with the given request, returning an error containing the resource key.
If the “log_error_context” feature is enabled, this logs the whole request. Either way, it returns an error with the resource key portion of the request as context.
Logs the data error with the given context, then return self.
This does not modify the error, but if the “log_error_context” feature is enabled, it will print out the context.
Logs the data error with the given context, then return self.
This does not modify the error, but if the “log_error_context” feature is enabled, it will print out the context.
Logs the data error with the given context, then return self.
This does not modify the error, but if the “log_error_context” feature is enabled, it will print out the context.
Logs the data error with the given context, then return self.
This does not modify the error, but if the “log_error_context” feature is enabled, it will print out the context.
Trait Implementations
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for DataError
impl UnwindSafe for DataError
Blanket Implementations
Mutably borrows from an owned value. Read more
fn filterable(
self,
filter_name: &'static str
) -> RequestFilterDataProvider<Self, fn(_: &DataRequest) -> bool>
fn filterable(
self,
filter_name: &'static str
) -> RequestFilterDataProvider<Self, fn(_: &DataRequest) -> bool>
Creates a filterable data provider with the given name for debugging. Read more