Struct io_uring::types::CancelBuilder
source · pub struct CancelBuilder { /* private fields */ }
Expand description
CancelBuilder constructs match criteria for request cancellation.
The CancelBuilder can be used to selectively cancel one or more requests by user_data, fd, fixed fd, or unconditionally.
§Examples
use io_uring::types::{CancelBuilder, Fd, Fixed};
// Match all in-flight requests.
CancelBuilder::any();
// Match a single request with user_data = 42.
CancelBuilder::user_data(42);
// Match a single request with fd = 42.
CancelBuilder::fd(Fd(42));
// Match a single request with fixed fd = 42.
CancelBuilder::fd(Fixed(42));
// Match all in-flight requests with user_data = 42.
CancelBuilder::user_data(42).all();
Implementations§
source§impl CancelBuilder
impl CancelBuilder
sourcepub const fn any() -> Self
pub const fn any() -> Self
Create a new CancelBuilder which will match any in-flight request.
This will cancel every in-flight request in the ring.
Async cancellation matching any requests is only available since 5.19.
sourcepub const fn user_data(user_data: u64) -> Self
pub const fn user_data(user_data: u64) -> Self
Create a new CancelBuilder which will match in-flight requests
with the given user_data
value.
The first request with the given user_data
value will be canceled.
CancelBuilder::all can be called to instead match every
request with the provided user_data
value.
sourcepub fn fd(fd: impl UseFixed) -> Self
pub fn fd(fd: impl UseFixed) -> Self
Create a new CancelBuilder which will match in-flight requests with
the given fd
value.
The first request with the given fd
value will be canceled. CancelBuilder::all
can be called to instead match every request with the provided fd
value.
FD async cancellation is only available since 5.19.
sourcepub fn all(self) -> Self
pub fn all(self) -> Self
Modify the CancelBuilder match criteria to match all in-flight requests rather than just the first one.
This has no effect when combined with CancelBuilder::any.
Async cancellation matching all requests is only available since 5.19.