pub struct Opcode { /* private fields */ }
Expand description
The opcode used by an Ioctl
.
Implementations§
source§impl Opcode
impl Opcode
sourcepub const fn old(raw: RawOpcode) -> Self
pub const fn old(raw: RawOpcode) -> Self
Create a new old Opcode
from a raw opcode.
Rather than being a composition of several attributes, old opcodes are just numbers. In general most drivers follow stricter conventions, but older drivers may still use this strategy.
sourcepub const fn from_components(
direction: Direction,
group: u8,
number: u8,
data_size: usize
) -> Self
pub const fn from_components( direction: Direction, group: u8, number: u8, data_size: usize ) -> Self
Create a new opcode from a direction, group, number, and size.
This corresponds to the C macro _IOC(direction, group, number, size)
sourcepub const fn none<T>(group: u8, number: u8) -> Self
pub const fn none<T>(group: u8, number: u8) -> Self
Create a new non-mutating opcode from a group, a number, and the type of data.
This corresponds to the C macro _IO(group, number)
when T
is zero
sized.
sourcepub const fn read<T>(group: u8, number: u8) -> Self
pub const fn read<T>(group: u8, number: u8) -> Self
Create a new reading opcode from a group, a number and the type of data.
This corresponds to the C macro _IOR(group, number, T)
.
sourcepub const fn write<T>(group: u8, number: u8) -> Self
pub const fn write<T>(group: u8, number: u8) -> Self
Create a new writing opcode from a group, a number and the type of data.
This corresponds to the C macro _IOW(group, number, T)
.
sourcepub const fn read_write<T>(group: u8, number: u8) -> Self
pub const fn read_write<T>(group: u8, number: u8) -> Self
Create a new reading and writing opcode from a group, a number and the type of data.
This corresponds to the C macro _IOWR(group, number, T)
.
Trait Implementations§
source§impl Ord for Opcode
impl Ord for Opcode
source§impl PartialEq for Opcode
impl PartialEq for Opcode
source§impl PartialOrd for Opcode
impl PartialOrd for Opcode
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more