Struct diagnostics_data::Data
source · pub struct Data<D: DiagnosticsData> {
pub data_source: DataSource,
pub metadata: D::Metadata,
pub moniker: ExtendedMoniker,
pub payload: Option<DiagnosticsHierarchy<D::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::Metadata
The metadata for the diagnostics payload.
moniker: ExtendedMoniker
Moniker of the component that generated the payload.
payload: Option<DiagnosticsHierarchy<D::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<Logs>
impl Data<Logs>
sourcepub fn for_logs(
moniker: ExtendedMoniker,
payload: Option<LogsHierarchy>,
timestamp: impl Into<Timestamp>,
component_url: Option<FlyStr>,
severity: impl Into<Severity>,
errors: Vec<LogError>,
) -> Self
pub fn for_logs( moniker: ExtendedMoniker, payload: Option<LogsHierarchy>, timestamp: impl Into<Timestamp>, component_url: Option<FlyStr>, severity: impl Into<Severity>, errors: Vec<LogError>, ) -> Self
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) -> Cow<'_, str>
pub fn component_name(&self) -> Cow<'_, str>
Returns the component nam. This only makes sense for v1 components.
Trait Implementations§
source§impl<'de, D: DiagnosticsData> Deserialize<'de> for Data<D>where
D::Metadata: DeserializeOwned,
impl<'de, D: DiagnosticsData> Deserialize<'de> for Data<D>where
D::Metadata: DeserializeOwned,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::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>
source§impl<D: PartialEq + DiagnosticsData> PartialEq for Data<D>
impl<D: PartialEq + DiagnosticsData> PartialEq for Data<D>
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 moresource§impl<D: DiagnosticsData> Serialize for Data<D>
impl<D: DiagnosticsData> Serialize for Data<D>
impl Eq for Data<Logs>
impl<D: DiagnosticsData> StructuralPartialEq for Data<D>
Auto Trait Implementations§
impl<D> Freeze for Data<D>
impl<D> RefUnwindSafe for Data<D>
impl<D> Send for Data<D>
impl<D> Sync for Data<D>
impl<D> Unpin for Data<D>
impl<D> UnwindSafe for Data<D>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)