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 PartialOrd for Opcode
impl PartialOrd for Opcode
impl Copy for Opcode
impl Eq for Opcode
impl StructuralPartialEq for Opcode
Auto Trait Implementations§
impl Freeze for Opcode
impl RefUnwindSafe for Opcode
impl Send for Opcode
impl Sync for Opcode
impl Unpin for Opcode
impl UnwindSafe for Opcode
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)