Skip to main content

DeviceSample

Trait DeviceSample 

Source
pub trait DeviceSample: Sized + Clone {
    // Required methods
    fn sample_kind() -> &'static str;
    fn seq(&self) -> u64;
    fn to_expr(&self) -> Expr;
    fn from_expr(expr: &Expr) -> DeviceSampleResult<Self>;
}
Expand description

Trait implemented by concrete device sample records.

A sample has a stable kind tag, a monotone sequence number, and strict expression round-tripping. from_expr is fail-closed: it returns an error for missing fields, wrong field types, unknown kind tags, or malformed sequence numbers.

Required Methods§

Source

fn sample_kind() -> &'static str

Stable bare sample kind, such as device-caps.

Source

fn seq(&self) -> u64

Monotone sequence number for ordering and aging samples.

Source

fn to_expr(&self) -> Expr

Encodes the sample as a self-describing expression map.

Source

fn from_expr(expr: &Expr) -> DeviceSampleResult<Self>

Decodes the sample from its expression map.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§