Skip to main content

Command

Trait Command 

Source
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).

  • INDEX is 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§

Source

const INDEX: u8

The fixed command index (e.g., 17 for CMD17).

Required Associated Types§

Source

type Resp<'a>: Response where Self: 'a

The associated response type for this command.

Required Methods§

Source

fn arg(&self) -> u32

Compute the 32-bit argument for this command.

Provided Methods§

Source

fn index(&self) -> u8

The fixed command index (e.g., 17 for CMD17).

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T: Command> Command for &T

Source§

const INDEX: u8 = T::INDEX

Source§

type Resp<'a> = <T as Command>::Resp<'a> where Self: 'a

Source§

fn arg(&self) -> u32

Source§

impl<T: Command> Command for &mut T

Source§

const INDEX: u8 = T::INDEX

Source§

type Resp<'a> = <T as Command>::Resp<'a> where Self: 'a

Source§

fn arg(&self) -> u32

Implementors§

Source§

impl Command for Acmd6

Source§

const INDEX: u8 = 6

Source§

type Resp<'a> = R1

Source§

impl Command for Acmd23

Source§

const INDEX: u8 = 23

Source§

type Resp<'a> = R1

Source§

impl Command for Acmd41

Source§

const INDEX: u8 = 41

Source§

type Resp<'a> = R3

Source§

impl Command for Cmd0

Source§

const INDEX: u8 = 0

Source§

type Resp<'a> = R0

Source§

impl Command for Cmd0S

Source§

const INDEX: u8 = 0

Source§

type Resp<'a> = R1

Source§

impl Command for Cmd1

Source§

const INDEX: u8 = 1

Source§

type Resp<'a> = R3

Source§

impl Command for Cmd2

Source§

const INDEX: u8 = 2

Source§

type Resp<'a> = R2

Source§

impl Command for sdio::emmc::Cmd3

Source§

const INDEX: u8 = 3

Source§

type Resp<'a> = R1

Source§

impl Command for sdio::sd::Cmd3

Source§

const INDEX: u8 = 3

Source§

type Resp<'a> = R6

Source§

impl Command for sdio::emmc::Cmd5

Source§

const INDEX: u8 = 5

Source§

type Resp<'a> = R1

Source§

impl Command for sdio::sdio::Cmd5

Source§

const INDEX: u8 = 5

Source§

type Resp<'a> = R4

Source§

impl Command for sdio::emmc::Cmd6

Source§

const INDEX: u8 = 6

Source§

type Resp<'a> = R1b

Source§

impl Command for Cmd7

Source§

const INDEX: u8 = 7

Source§

type Resp<'a> = R1

Source§

impl Command for sdio::sd::Cmd8

Source§

const INDEX: u8 = 8

Source§

type Resp<'a> = R7

Source§

impl Command for Cmd9

Source§

const INDEX: u8 = 9

Source§

type Resp<'a> = R2

Source§

impl Command for Cmd10

Source§

const INDEX: u8 = 10

Source§

type Resp<'a> = R2

Source§

impl Command for Cmd11

Source§

const INDEX: u8 = 11

Source§

type Resp<'a> = R1

Source§

impl Command for Cmd12

Source§

const INDEX: u8 = 12

Source§

type Resp<'a> = R1b

Source§

impl Command for Cmd13

Source§

const INDEX: u8 = 13

Source§

type Resp<'a> = R1

Source§

impl Command for Cmd16

Source§

const INDEX: u8 = 16

Source§

type Resp<'a> = R1

Source§

impl Command for Cmd20

Source§

const INDEX: u8 = 20

Source§

type Resp<'a> = R1

Source§

impl Command for Cmd22

Source§

const INDEX: u8 = 22

Source§

type Resp<'a> = R1

Source§

impl Command for Cmd23

Source§

const INDEX: u8 = 23

Source§

type Resp<'a> = R1

Source§

impl Command for Cmd32

Source§

const INDEX: u8 = 32

Source§

type Resp<'a> = R1

Source§

impl Command for Cmd33

Source§

const INDEX: u8 = 33

Source§

type Resp<'a> = R1

Source§

impl Command for Cmd35

Source§

const INDEX: u8 = 35

Source§

type Resp<'a> = R1

Source§

impl Command for sdio::emmc::Cmd36

Source§

const INDEX: u8 = 36

Source§

type Resp<'a> = R1

Source§

impl Command for sdio::sd::Cmd36

Source§

const INDEX: u8 = 36

Source§

type Resp<'a> = R1

Source§

impl Command for Cmd38

Source§

const INDEX: u8 = 38

Source§

type Resp<'a> = R1b

Source§

impl Command for Cmd39

Source§

const INDEX: u8 = 39

Source§

type Resp<'a> = R1

Source§

impl Command for Cmd40

Source§

const INDEX: u8 = 40

Source§

type Resp<'a> = R1

Source§

impl Command for Cmd52

Source§

const INDEX: u8 = 52

Source§

type Resp<'a> = R5

Source§

impl Command for Cmd55

Source§

const INDEX: u8 = 55

Source§

type Resp<'a> = R1

Source§

impl Command for Cmd58

Source§

const INDEX: u8 = 58

Source§

type Resp<'a> = R3

Source§

impl<'a, const BLOCK_SIZE: usize> Command for Cmd17<'a, BLOCK_SIZE>

Source§

const INDEX: u8 = 17

Source§

type Resp<'b> = R1 where Self: 'b

Source§

impl<'a, const BLOCK_SIZE: usize> Command for Cmd18<'a, BLOCK_SIZE>

Source§

const INDEX: u8 = 18

Source§

type Resp<'b> = R1 where Self: 'b

Source§

impl<'a, const BLOCK_SIZE: usize> Command for Cmd24<'a, BLOCK_SIZE>

Source§

const INDEX: u8 = 24

Source§

type Resp<'b> = R1b where Self: 'b

Source§

impl<'a, const BLOCK_SIZE: usize> Command for Cmd25<'a, BLOCK_SIZE>

Source§

const INDEX: u8 = 25

Source§

type Resp<'b> = R1b where Self: 'b

Source§

impl<'a, const BLOCK_SIZE: usize> Command for Cmd53BlockRead<'a, BLOCK_SIZE>

Source§

const INDEX: u8 = 53

Source§

type Resp<'b> = R5 where Self: 'b

Source§

impl<'a, const BLOCK_SIZE: usize> Command for Cmd53BlockWrite<'a, BLOCK_SIZE>

Source§

const INDEX: u8 = 53

Source§

type Resp<'b> = R5 where Self: 'b

Source§

impl<'a> Command for Acmd13<'a>

Source§

const INDEX: u8 = 13

Source§

type Resp<'b> = R1 where Self: 'b

Source§

impl<'a> Command for Acmd51<'a>

Source§

const INDEX: u8 = 51

Source§

type Resp<'b> = R1 where Self: 'b

Source§

impl<'a> Command for sdio::sd::Cmd6<'a>

Source§

const INDEX: u8 = 6

Source§

type Resp<'b> = R1 where Self: 'b

Source§

impl<'a> Command for sdio::emmc::Cmd8<'a>

Source§

const INDEX: u8 = 8

Source§

type Resp<'b> = R1 where Self: 'b

Source§

impl<'a> Command for Cmd53ByteRead<'a>

Source§

const INDEX: u8 = 53

Source§

type Resp<'b> = R5 where Self: 'b

Source§

impl<'a> Command for Cmd53ByteWrite<'a>

Source§

const INDEX: u8 = 53

Source§

type Resp<'b> = R5 where Self: 'b

Source§

impl<'b> Command for Cmd19<'b>

Source§

const INDEX: u8 = 19

Source§

type Resp<'a> = R1 where Self: 'a