Trait diagnostics_data::DiagnosticsData
source · pub trait DiagnosticsData {
type Metadata: DeserializeOwned + Serialize + Clone + Send + 'static;
type Key: AsRef<str> + Clone + DeserializeOwned + Eq + FromStr + Hash + Send + 'static;
type Error: Clone;
const DATA_TYPE: DataType;
// Required methods
fn component_url(metadata: &Self::Metadata) -> Option<&str>;
fn timestamp(metadata: &Self::Metadata) -> Timestamp;
fn errors(metadata: &Self::Metadata) -> &Option<Vec<Self::Error>>;
fn override_error(metadata: Self::Metadata, error: String) -> Self::Metadata;
// Provided method
fn has_errors(metadata: &Self::Metadata) -> bool { ... }
}
Expand description
A trait implemented by marker types which denote “kinds” of diagnostics data.
Required Associated Types§
sourcetype Metadata: DeserializeOwned + Serialize + Clone + Send + 'static
type Metadata: DeserializeOwned + Serialize + Clone + Send + 'static
The type of metadata included in results of this type.
Required Associated Constants§
Required Methods§
sourcefn component_url(metadata: &Self::Metadata) -> Option<&str>
fn component_url(metadata: &Self::Metadata) -> Option<&str>
Returns the component URL which generated this value.
sourcefn timestamp(metadata: &Self::Metadata) -> Timestamp
fn timestamp(metadata: &Self::Metadata) -> Timestamp
Returns the timestamp at which this value was recorded.
sourcefn errors(metadata: &Self::Metadata) -> &Option<Vec<Self::Error>>
fn errors(metadata: &Self::Metadata) -> &Option<Vec<Self::Error>>
Returns the errors recorded with this value, if any.
sourcefn override_error(metadata: Self::Metadata, error: String) -> Self::Metadata
fn override_error(metadata: Self::Metadata, error: String) -> Self::Metadata
Transforms a Metdata string into a errorful metadata, overriding any other errors.
Provided Methods§
sourcefn has_errors(metadata: &Self::Metadata) -> bool
fn has_errors(metadata: &Self::Metadata) -> bool
Returns whether any errors are recorded on this value.