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,

source

pub fn drop_payload(&mut self)

Returns a Data with an error indicating that the payload was dropped.

source

pub fn sort_payload(&mut self)

Sorts this Data’s payload if one is present.

source

pub fn filter(self, selectors: &[Selector]) -> Result<Option<Data<D>>, Error>

Uses a set of Selectors to filter self’s payload and returns the resulting Data. If the resulting payload is empty, it returns Ok(None).

source§

impl Data<Inspect>

source

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

pub fn name(&self) -> Option<&str>

Access the name or filename within self.metadata.

source§

impl Data<Logs>

source

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.

source

pub fn msg(&self) -> Option<&str>

Returns the string log associated with the message, if one exists.

source

pub fn msg_mut(&mut self) -> Option<&mut String>

If the log has a message, returns a shared reference to the message contents.

source

pub fn payload_message(&self) -> Option<&DiagnosticsHierarchy<LogsField>>

If the log has message, returns an exclusive reference to it.

source

pub fn payload_keys(&self) -> Option<&DiagnosticsHierarchy<LogsField>>

If the log has structured keys, returns an exclusive reference to them.

source

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”.

source

pub fn payload_message_mut( &mut self ) -> Option<&mut DiagnosticsHierarchy<LogsField>>

If the log has a message, returns a mutable reference to it.

source

pub fn file_path(&self) -> Option<&str>

Returns the file path associated with the message, if one exists.

source

pub fn line_number(&self) -> Option<&u64>

Returns the line number associated with the message, if one exists.

source

pub fn pid(&self) -> Option<u64>

Returns the pid associated with the message, if one exists.

source

pub fn tid(&self) -> Option<u64>

Returns the tid associated with the message, if one exists.

source

pub fn tags(&self) -> Option<&Vec<String>>

Returns the tags associated with the message, if any exist.

source

pub fn legacy_severity(&self) -> LegacySeverity

The message’s severity.

source

pub fn severity(&self) -> Severity

Returns the severity level of this log.

source

pub fn dropped_logs(&self) -> Option<u64>

Returns number of dropped logs if reported in the message.

source

pub fn rolled_out_logs(&self) -> Option<u64>

Returns number of rolled out logs if reported in the message.

source

pub fn raw_severity(&self) -> Option<i8>

If the log has a raw severity, returns its value.

source

pub fn set_raw_severity(&mut self, raw_severity: i8)

Sets the raw severity of a log.

source

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>

source§

impl<D> Clone for Data<D>

source§

fn clone(&self) -> Data<D>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<D> Debug for Data<D>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

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>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for Data<Logs>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Into<LogMessage> for &Data<Logs>

Convert this Message to a FIDL representation suitable for sending to LogListenerSafe.

source§

fn into(self) -> LogMessage

Converts this type into the (usually inferred) input type.
source§

impl Into<LogMessage> for Data<Logs>

Convert this Message to a FIDL representation suitable for sending to LogListenerSafe.

source§

fn into(self) -> LogMessage

Converts this type into the (usually inferred) input type.
source§

impl Ord for Data<Logs>

source§

fn cmp(&self, other: &Data<Logs>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<D> PartialEq for Data<D>

source§

fn eq(&self, other: &Data<D>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Data<Logs>

source§

fn partial_cmp(&self, other: &Data<Logs>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<D> Serialize for Data<D>

source§

fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for Data<Logs>

source§

impl<D> StructuralPartialEq for Data<D>
where D: DiagnosticsData,

Auto Trait Implementations§

§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Encode<Ambiguous1> for T

§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _offset: usize, _depth: Depth ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
§

impl<T> Encode<Ambiguous2> for T

§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _offset: usize, _depth: Depth ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IntoAny for T
where T: 'static + Send + Sync,

§

fn into_any(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Cast the given object into a dyn std::any::Any.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,