Struct Interest

struct Interest(_)

Readiness event interest.

Specifies the readiness events the caller is interested in when awaiting on I/O resource readiness states.

Implementations

impl Interest

const fn is_readable(self: Self) -> bool

Returns true if the value includes readable interest.

Examples

use tokio::io::Interest;

assert!(Interest::READABLE.is_readable());
assert!(!Interest::WRITABLE.is_readable());

let both = Interest::READABLE | Interest::WRITABLE;
assert!(both.is_readable());
const fn is_writable(self: Self) -> bool

Returns true if the value includes writable interest.

Examples

use tokio::io::Interest;

assert!(!Interest::READABLE.is_writable());
assert!(Interest::WRITABLE.is_writable());

let both = Interest::READABLE | Interest::WRITABLE;
assert!(both.is_writable());
const fn is_error(self: Self) -> bool

Returns true if the value includes error interest.

Examples

use tokio::io::Interest;

assert!(Interest::ERROR.is_error());
assert!(!Interest::WRITABLE.is_error());

let combined = Interest::READABLE | Interest::ERROR;
assert!(combined.is_error());
const fn is_priority(self: Self) -> bool

Returns true if the value includes priority interest.

Examples

use tokio::io::Interest;

assert!(!Interest::READABLE.is_priority());
assert!(Interest::PRIORITY.is_priority());

let both = Interest::READABLE | Interest::PRIORITY;
assert!(both.is_priority());
const fn add(self: Self, other: Interest) -> Interest

Add together two Interest values.

This function works from a const context.

Examples

use tokio::io::Interest;

const BOTH: Interest = Interest::READABLE.add(Interest::WRITABLE);

assert!(BOTH.is_readable());
assert!(BOTH.is_writable());
fn remove(self: Self, other: Interest) -> Option<Interest>

Remove Interest from self.

Interests present in other but not in self are ignored.

Returns None if the set would be empty after removing Interest.

Examples

use tokio::io::Interest;

const RW_INTEREST: Interest = Interest::READABLE.add(Interest::WRITABLE);

let w_interest = RW_INTEREST.remove(Interest::READABLE).unwrap();
assert!(!w_interest.is_readable());
assert!(w_interest.is_writable());

// Removing all interests from the set returns `None`.
assert_eq!(w_interest.remove(Interest::WRITABLE), None);

// Remove all interests at once.
assert_eq!(RW_INTEREST.remove(RW_INTEREST), None);

impl BitOr for Interest

fn bitor(self: Self, other: Self) -> Self

impl BitOrAssign for Interest

fn bitor_assign(self: &mut Self, other: Self)

impl Clone for Interest

fn clone(self: &Self) -> Interest

impl Copy for Interest

impl Debug for Interest

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

impl Eq for Interest

impl Freeze for Interest

impl PartialEq for Interest

fn eq(self: &Self, other: &Interest) -> bool

impl RefUnwindSafe for Interest

impl Send for Interest

impl StructuralPartialEq for Interest

impl Sync for Interest

impl Unpin for Interest

impl UnsafeUnpin for Interest

impl UnwindSafe for Interest

impl<T> Any for Interest

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Interest

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Interest

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

impl<T> CloneToUninit for Interest

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for Interest

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Interest

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for Interest

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for Interest

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

impl<T, U> TryInto for Interest

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