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 set_raw_severity(&mut self, raw_severity: u8)
pub fn set_raw_severity(&mut self, raw_severity: u8)
Sets the severity from a raw severity number. Overrides the severity to match the raw severity.
Sourcepub fn set_severity(&mut self, severity: Severity)
pub fn set_severity(&mut self, severity: Severity)
Sets the severity of the log. This will unset the raw severity.
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 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 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 From<&Data<Logs>> for LogMessage
impl From<&Data<Logs>> for LogMessage
Convert this Message
to a FIDL representation suitable for sending to LogListenerSafe
.
Source§impl From<Data<Logs>> for LogMessage
impl From<Data<Logs>> for LogMessage
Convert this Message
to a FIDL representation suitable for sending to LogListenerSafe
.
Source§impl Ord for Data<Logs>
impl Ord for Data<Logs>
Source§impl PartialOrd for Data<Logs>
impl PartialOrd for Data<Logs>
Source§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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)