pub trait Command {
type Resp<'a>: Response
where Self: 'a;
const INDEX: u8;
// Required method
fn arg(&self) -> u32;
// Provided method
fn index(&self) -> u8 { ... }
}Expand description
§Command Trait (with GAT for response type)
Represents a protocol command (CMD0–CMD63, ACMDs, CMD52/53 for SDIO).
INDEXis the fixed command index from the SD/MMC/SDIO spec.arg()returns the 32-bit argument field.Resp<'a>is the associated response type for this command.
This gives you compile-time correctness:
- CMD8 always returns R7
- CMD17 always returns R1
- CMD9 always returns R2
No downcasting, no runtime parsing, no mistakes.
Required Associated Constants§
Required Associated Types§
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".