Struct tokio::io::Interest

source ·
pub struct Interest(_);
Expand description

Readiness event interest.

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

Implementations§

source§

impl Interest

source

pub const READABLE: Interest = _

Interest in all readable events.

Readable interest includes read-closed events.

source

pub const WRITABLE: Interest = _

Interest in all writable events.

Writable interest includes write-closed events.

source

pub const ERROR: Interest = _

Interest in error events.

Passes error interest to the underlying OS selector. Behavior is platform-specific, read your platform’s documentation.

source

pub const PRIORITY: Interest = _

Returns a Interest set representing priority completion interests.

source

pub const fn is_readable(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());
source

pub const fn is_writable(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());
source

pub const fn is_error(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());
source

pub const fn is_priority(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());
source

pub const fn add(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());

Trait Implementations§

source§

impl BitOr<Interest> for Interest

§

type Output = Interest

The resulting type after applying the | operator.
source§

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

Performs the | operation. Read more
source§

impl BitOrAssign<Interest> for Interest

source§

fn bitor_assign(&mut self, other: Self)

Performs the |= operation. Read more
source§

impl Clone for Interest

source§

fn clone(&self) -> Interest

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Interest

source§

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

Formats the value using the given formatter. Read more
source§

impl PartialEq<Interest> for Interest

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Interest

source§

impl Eq for Interest

source§

impl StructuralEq for Interest

source§

impl StructuralPartialEq for Interest

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.