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
)Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 4 bytes