diagnostics_data

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

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<Self>, 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 name(&self) -> &str

Access the name or filename within self.metadata.

Source§

impl Data<Logs>

Source

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.

Source

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.

Source

pub fn set_severity(&mut self, severity: Severity)

Sets the severity of the log. This will unset the raw severity.

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 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 component_name(&self) -> Cow<'_, str>

Returns the component nam. This only makes sense for v1 components.

Trait Implementations§

Source§

impl<D: Clone + DiagnosticsData> Clone for Data<D>
where D::Metadata: Clone, D::Key: Clone,

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 + DiagnosticsData> Debug for Data<D>
where D::Metadata: Debug, D::Key: Debug,

Source§

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

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

impl<'de, D: DiagnosticsData> Deserialize<'de> for Data<D>

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::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

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

impl From<&Data<Logs>> for LogMessage

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

Source§

fn from(data: &Data<Logs>) -> LogMessage

Converts to this type from the input type.
Source§

impl From<Data<Logs>> for LogMessage

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

Source§

fn from(data: Data<Logs>) -> LogMessage

Converts to this type from the input type.
Source§

impl Ord for Data<Logs>

Source§

fn cmp(&self, other: &Self) -> 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,

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

impl<D: PartialEq + DiagnosticsData> PartialEq for Data<D>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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: &Self) -> 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

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

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

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<D: DiagnosticsData> Serialize for Data<D>
where D::Metadata: Serialize,

Source§

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

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

impl Eq for Data<Logs>

Source§

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> 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
Source§

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

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _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, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _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> 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,

Source§

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

Source§

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

Source§

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