pub trait Action: ActionDeriv + ActionCompute {
// Provided methods
fn canonical_bytes(&self) -> Vec<u8> ⓘ
where Self: Sized { ... }
fn from_bytes(
version: u32,
bytes: &[u8],
) -> Result<Box<Self>, DeserializeError>
where Self: Sized { ... }
fn approx_size(&self) -> usize
where Self: Sized { ... }
}Expand description
Action — kernel-facing trait. Composed automatically by the
blanket below: any T: ActionDeriv + ActionCompute is Action.
External code never implements this directly.
Default method bodies use postcard for the canonical-bytes round
trip (R3v3-Δ2). approx_size defaults to the encoded length;
override only if a cheaper estimate is required.
Provided Methods§
Sourcefn canonical_bytes(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn canonical_bytes(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Postcard-canonical byte encoding. See
Component::canonical_bytes for the contract; identical
shape applies here.
Sourcefn from_bytes(version: u32, bytes: &[u8]) -> Result<Box<Self>, DeserializeError>where
Self: Sized,
fn from_bytes(version: u32, bytes: &[u8]) -> Result<Box<Self>, DeserializeError>where
Self: Sized,
Inverse of canonical_bytes.
SchemaVersionMismatch on unequal version.
Sourcefn approx_size(&self) -> usizewhere
Self: Sized,
fn approx_size(&self) -> usizewhere
Self: Sized,
Approximate byte size — defaults to encoded length.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.