pub trait EmbeddedState:
Pod
+ Zeroable
+ Default
+ Copy
+ Send
+ Sync
+ 'static {
const VERSION: u32 = 1;
// Provided method
fn is_embedded() -> bool { ... }
}Expand description
Trait for state types that can be embedded directly in ControlBlock.
Types implementing this trait must:
- Be
Pod+Zeroable(plain old data, safe to reinterpret) - Be
Defaultfor initialization - Be
Copyfor efficient transfer - Fit within 24 bytes (checked at compile time via
EmbeddedStateSize)
§Example
ⓘ
#[derive(Default, Clone, Copy, Pod, Zeroable)]
#[repr(C, align(8))]
struct MyState {
value_a: u64,
value_b: u64,
counter: u32,
_pad: u32,
}
impl EmbeddedState for MyState {}Provided Associated Constants§
Provided Methods§
Sourcefn is_embedded() -> bool
fn is_embedded() -> bool
Whether this state is embedded (true) or external (false).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".