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

source

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.

source

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.

source

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.

source

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.

Trait Implementations§

source§

impl Debug for CancelBuilder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.