Struct diagnostics_reader::Data
source · pub struct Data<D>where
D: DiagnosticsData,{
pub data_source: DataSource,
pub metadata: <D as DiagnosticsData>::Metadata,
pub moniker: String,
pub payload: Option<DiagnosticsHierarchy<<D as DiagnosticsData>::Key>>,
pub version: u64,
}
Expand description
An instance of diagnostics data with typed metadata and an optional nested payload.
Fields§
§data_source: DataSource
The source of the data.
metadata: <D as DiagnosticsData>::Metadata
The metadata for the diagnostics payload.
moniker: String
Moniker of the component that generated the payload.
payload: Option<DiagnosticsHierarchy<<D as DiagnosticsData>::Key>>
Payload containing diagnostics data, if the payload exists, else None.
version: u64
Schema version.
Implementations§
source§impl<D> Data<D>where
D: DiagnosticsData,
impl<D> Data<D>where
D: DiagnosticsData,
sourcepub fn drop_payload(&mut self)
pub fn drop_payload(&mut self)
Returns a Data
with an error indicating that the payload was dropped.
sourcepub fn sort_payload(&mut self)
pub fn sort_payload(&mut self)
Sorts this Data
’s payload if one is present.
source§impl Data<Inspect>
impl Data<Inspect>
sourcepub fn for_inspect(
moniker: impl Into<String>,
inspect_hierarchy: Option<DiagnosticsHierarchy>,
timestamp: impl Into<Timestamp>,
component_url: impl Into<String>,
name: Option<InspectHandleName>,
errors: Vec<InspectError>
) -> Data<Inspect>
pub fn for_inspect( moniker: impl Into<String>, inspect_hierarchy: Option<DiagnosticsHierarchy>, timestamp: impl Into<Timestamp>, component_url: impl Into<String>, name: Option<InspectHandleName>, errors: Vec<InspectError> ) -> Data<Inspect>
Creates a new data instance for inspect.
source§impl Data<Logs>
impl Data<Logs>
sourcepub fn for_logs(
moniker: impl Into<String>,
payload: Option<DiagnosticsHierarchy<LogsField>>,
timestamp: impl Into<Timestamp>,
component_url: Option<String>,
severity: impl Into<Severity>,
errors: Vec<LogError>
) -> Data<Logs>
pub fn for_logs( moniker: impl Into<String>, payload: Option<DiagnosticsHierarchy<LogsField>>, timestamp: impl Into<Timestamp>, component_url: Option<String>, severity: impl Into<Severity>, errors: Vec<LogError> ) -> Data<Logs>
Creates a new data instance for logs.
sourcepub fn msg(&self) -> Option<&str>
pub fn msg(&self) -> Option<&str>
Returns the string log associated with the message, if one exists.
sourcepub fn msg_mut(&mut self) -> Option<&mut String>
pub fn msg_mut(&mut self) -> Option<&mut String>
If the log has a message, returns a shared reference to the message contents.
sourcepub fn payload_message(&self) -> Option<&DiagnosticsHierarchy<LogsField>>
pub fn payload_message(&self) -> Option<&DiagnosticsHierarchy<LogsField>>
If the log has message, returns an exclusive reference to it.
sourcepub fn payload_keys(&self) -> Option<&DiagnosticsHierarchy<LogsField>>
pub fn payload_keys(&self) -> Option<&DiagnosticsHierarchy<LogsField>>
If the log has structured keys, returns an exclusive reference to them.
sourcepub fn payload_keys_strings(&self) -> Box<dyn Iterator<Item = String> + '_>
pub fn payload_keys_strings(&self) -> Box<dyn Iterator<Item = String> + '_>
Returns an iterator over the payload keys as strings with the format “key=value”.
sourcepub fn payload_message_mut(
&mut self
) -> Option<&mut DiagnosticsHierarchy<LogsField>>
pub fn payload_message_mut( &mut self ) -> Option<&mut DiagnosticsHierarchy<LogsField>>
If the log has a message, returns a mutable reference to it.
sourcepub fn file_path(&self) -> Option<&str>
pub fn file_path(&self) -> Option<&str>
Returns the file path associated with the message, if one exists.
sourcepub fn line_number(&self) -> Option<&u64>
pub fn line_number(&self) -> Option<&u64>
Returns the line number associated with the message, if one exists.
Returns the tags associated with the message, if any exist.
sourcepub fn legacy_severity(&self) -> LegacySeverity
pub fn legacy_severity(&self) -> LegacySeverity
The message’s severity.
sourcepub fn dropped_logs(&self) -> Option<u64>
pub fn dropped_logs(&self) -> Option<u64>
Returns number of dropped logs if reported in the message.
sourcepub fn rolled_out_logs(&self) -> Option<u64>
pub fn rolled_out_logs(&self) -> Option<u64>
Returns number of rolled out logs if reported in the message.
sourcepub fn raw_severity(&self) -> Option<i8>
pub fn raw_severity(&self) -> Option<i8>
If the log has a raw severity, returns its value.
sourcepub fn set_raw_severity(&mut self, raw_severity: i8)
pub fn set_raw_severity(&mut self, raw_severity: i8)
Sets the raw severity of a log.
sourcepub fn component_name(&self) -> &str
pub fn component_name(&self) -> &str
Returns the component nam. This only makes sense for v1 components.
Trait Implementations§
source§impl<D: DiagnosticsData> CheckResponse for Data<D>
impl<D: DiagnosticsData> CheckResponse for Data<D>
fn has_payload(&self) -> bool
fn was_fully_filtered(&self) -> bool
source§impl<D> Clone for Data<D>where
D: Clone + DiagnosticsData,
<D as DiagnosticsData>::Metadata: Clone,
<D as DiagnosticsData>::Key: Clone,
impl<D> Clone for Data<D>where
D: Clone + DiagnosticsData,
<D as DiagnosticsData>::Metadata: Clone,
<D as DiagnosticsData>::Key: Clone,
source§impl<D> Debug for Data<D>where
D: Debug + DiagnosticsData,
<D as DiagnosticsData>::Metadata: Debug,
<D as DiagnosticsData>::Key: Debug,
impl<D> Debug for Data<D>where
D: Debug + DiagnosticsData,
<D as DiagnosticsData>::Metadata: Debug,
<D as DiagnosticsData>::Key: Debug,
source§impl<'de, D> Deserialize<'de> for Data<D>
impl<'de, D> Deserialize<'de> for Data<D>
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<Data<D>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Data<D>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl Into<LogMessage> for &Data<Logs>
impl Into<LogMessage> for &Data<Logs>
Convert this Message
to a FIDL representation suitable for sending to LogListenerSafe
.
source§fn into(self) -> LogMessage
fn into(self) -> LogMessage
source§impl Into<LogMessage> for Data<Logs>
impl Into<LogMessage> for Data<Logs>
Convert this Message
to a FIDL representation suitable for sending to LogListenerSafe
.
source§fn into(self) -> LogMessage
fn into(self) -> LogMessage
source§impl Ord for Data<Logs>
impl Ord for Data<Logs>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl<D> PartialEq for Data<D>where
D: PartialEq + DiagnosticsData,
<D as DiagnosticsData>::Metadata: PartialEq,
<D as DiagnosticsData>::Key: PartialEq,
impl<D> PartialEq for Data<D>where
D: PartialEq + DiagnosticsData,
<D as DiagnosticsData>::Metadata: PartialEq,
<D as DiagnosticsData>::Key: PartialEq,
source§impl PartialOrd for Data<Logs>
impl PartialOrd for Data<Logs>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more