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§
Sourcefn sample_kind() -> &'static str
fn sample_kind() -> &'static str
Stable bare sample kind, such as device-caps.
Sourcefn from_expr(expr: &Expr) -> DeviceSampleResult<Self>
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".