pub struct Extra(/* private fields */);Expand description
Platform-specific extra data associated with a driver instance.
It can be used to set options for or get extra data from I/O operations.
Implementations§
Source§impl Extra
impl Extra
Sourcepub fn is_notification(&self) -> Result<bool>
pub fn is_notification(&self) -> Result<bool>
Checks whether this completion reports a notification (2nd CQE returned for a zerocopy op).
§Behaviour
This is only supported on io_uring drivers, in which the driver will
check whether the IORING_CQE_F_NOTIF flag was set by the kernel for
the CQE. On other platforms, this will always return the
Unsupported error.
Sourcepub fn buffer_id(&self) -> Result<u16>
pub fn buffer_id(&self) -> Result<u16>
Try to get the buffer ID associated with this operation.
§Behavior
This is only supported on io_uring drivers, in which the driver will
try to extract buffer_id returned by the kernel as a part of flags.
If the id cannot be extracted from the flag, an InvalidInput
io::Error will be returned. On other platforms, this will always
return Unsupported error.
Sourcepub fn get_personality(&self) -> Result<Option<u16>>
pub fn get_personality(&self) -> Result<Option<u16>>
Get the personality for this operation.
§Behavior
- If the driver is not
io_uring, returnUnsupportederror, - If the personality was not set with
set_personality, returnOk(None) - Otherwise, return
Ok(Some(personality))
Sourcepub fn sock_nonempty(&self) -> Result<bool>
pub fn sock_nonempty(&self) -> Result<bool>
Checks whether the underlying socket has more data to be read.
§Behaviour
This method must be used only on the flags for any of the receive
variants supported by IO_URING. The driver will try to check whether
the IORING_CQE_F_SOCK_NONEMPTY flag was set by the kernel for the CQE.
On other platforms, this will always return the Unsupported error.
Sourcepub fn set_drain(&mut self)
pub fn set_drain(&mut self)
Set the IOSQE_IO_DRAIN flag for this operation.
This ensures that this operation won’t start until all previously submitted operations complete.
See io_uring_sqe_set_flags(3) for more details.
This is a no-op when not using io_uring driver.
Sourcepub fn with_drain(self) -> Self
pub fn with_drain(self) -> Self
Call set_drain and return the modified Extra.
Sourcepub fn set_link(&mut self)
pub fn set_link(&mut self)
Set the IOSQE_IO_LINK flag for this operation.
This links this operation with the next one. The next operation will not start until this operation completed successfully.
See io_uring_sqe_set_flags(3) for more details.
This is a no-op when not using io_uring driver.
Sourcepub fn set_hardlink(&mut self)
pub fn set_hardlink(&mut self)
Set the IOSQE_IO_HARDLINK flag for this operation.
Like link, but the next operation will execute regardless of this operation’s result.
See io_uring_sqe_set_flags(3) for more details.
This is a no-op when not using io_uring driver.
Sourcepub fn with_hardlink(self) -> Self
pub fn with_hardlink(self) -> Self
Call set_hardlink and return the modified Extra.
Sourcepub fn set_personality(&mut self, personality: u16)
pub fn set_personality(&mut self, personality: u16)
Set the personality for this operation.
A personality represents a set of credentials (uid, gid, etc.) that will be used for this operation.
The personality can be retrieved with Proactor::register_personality.
This is a no-op when not using io_uring driver.
Sourcepub fn with_personality(self, personality: u16) -> Self
pub fn with_personality(self, personality: u16) -> Self
Call set_personality and return the modified Extra.