Spec-Zone.ru › Tokio

Struct Interest

pub struct Interest(/* private fields */);
Available on crate feature net, or tokio_unstable and Linux and crate feature fs and crate feature io-uring and crate feature rt only.

Readiness event interest.

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

Implementations

impl Interest

pub const AIO: Interest

Available on FreeBSD and crate feature net only.

Interest for POSIX AIO.

pub const LIO: Interest

Available on FreeBSD and crate feature net only.

Interest for POSIX AIO lio_listio events.

pub const READABLE: Interest

Available on crate feature net, or tokio_unstable and Linux and crate feature fs and crate feature io-uring and crate feature rt, or Unix and crate feature process, or Unix and crate feature signal only.

Interest in all readable events.

Readable interest includes read-closed events.

pub const WRITABLE: Interest

Available on crate feature net, or tokio_unstable and Linux and crate feature fs and crate feature io-uring and crate feature rt, or Unix and crate feature process, or Unix and crate feature signal only.

Interest in all writable events.

Writable interest includes write-closed events.

pub const ERROR: Interest

Available on crate feature net, or tokio_unstable and Linux and crate feature fs and crate feature io-uring and crate feature rt, or Unix and crate feature process, or Unix and crate feature signal only.

Interest in error events.

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

pub const PRIORITY: Interest

Available on Android or Linux only.

Returns a Interest set representing priority completion interests.

pub const fn is_readable(self) -> bool

Available on crate feature net, or tokio_unstable and Linux and crate feature fs and crate feature io-uring and crate feature rt, or Unix and crate feature process, or Unix and crate feature signal only.

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());

pub const fn is_writable(self) -> bool

Available on crate feature net, or tokio_unstable and Linux and crate feature fs and crate feature io-uring and crate feature rt, or Unix and crate feature process, or Unix and crate feature signal only.

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());

pub const fn is_error(self) -> bool

Available on crate feature net, or tokio_unstable and Linux and crate feature fs and crate feature io-uring and crate feature rt, or Unix and crate feature process, or Unix and crate feature signal only.

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());

pub const fn is_priority(self) -> bool

Available on Android or Linux only.

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());

pub const fn add(self, other: Interest) -> Interest

Available on crate feature net, or tokio_unstable and Linux and crate feature fs and crate feature io-uring and crate feature rt, or Unix and crate feature process, or Unix and crate feature signal only.

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());

pub fn remove(self, other: Interest) -> Option<Interest>

Available on crate feature net, or tokio_unstable and Linux and crate feature fs and crate feature io-uring and crate feature rt, or Unix and crate feature process, or Unix and crate feature signal only.

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);

Trait Implementations

impl BitOr for Interest

Available on crate feature net, or tokio_unstable and Linux and crate feature fs and crate feature io-uring and crate feature rt, or Unix and crate feature process, or Unix and crate feature signal only.

type Output = Interest

The resulting type after applying the | operator.

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

Performs the | operation. Read more

impl BitOrAssign for Interest

Available on crate feature net, or tokio_unstable and Linux and crate feature fs and crate feature io-uring and crate feature rt, or Unix and crate feature process, or Unix and crate feature signal only.

fn bitor_assign(&mut self, other: Self)

Performs the |= operation. Read more

impl Clone for Interest

Available on crate feature net, or tokio_unstable and Linux and crate feature fs and crate feature io-uring and crate feature rt, or Unix and crate feature process, or Unix and crate feature signal only.

fn clone(&self) -> Interest

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) ·

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

Performs copy-assignment from source. Read more

impl Copy for Interest

Available on crate feature net, or tokio_unstable and Linux and crate feature fs and crate feature io-uring and crate feature rt, or Unix and crate feature process, or Unix and crate feature signal only.

impl Debug for Interest

Available on crate feature net, or tokio_unstable and Linux and crate feature fs and crate feature io-uring and crate feature rt, or Unix and crate feature process, or Unix and crate feature signal only.

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

Formats the value using the given formatter. Read more

impl Eq for Interest

Available on crate feature net, or tokio_unstable and Linux and crate feature fs and crate feature io-uring and crate feature rt, or Unix and crate feature process, or Unix and crate feature signal only.

impl PartialEq for Interest

Available on crate feature net, or tokio_unstable and Linux and crate feature fs and crate feature io-uring and crate feature rt, or Unix and crate feature process, or Unix and crate feature signal only.

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

Equality operator ==. Read more
1.0.0 (const: unstable) ·

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

Inequality operator !=. Read more

impl StructuralPartialEq for Interest

Available on crate feature net, or tokio_unstable and Linux and crate feature fs and crate feature io-uring and crate feature rt, or Unix and crate feature process, or Unix and crate feature signal only.

Auto Trait Implementations

impl Freeze for Interest

impl RefUnwindSafe for Interest

impl Send for Interest

impl Sync for Interest

impl Unpin for Interest

impl UnsafeUnpin for Interest

impl UnwindSafe for Interest

Blanket Implementations

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

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more

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

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

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

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

Mutably borrows from an owned value. Read more

impl<T> CloneToUninit for T
where T: Clone,

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more

impl<T> From<T> for T

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for T

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

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

fn into(self) -> U

Calls U::from(self).

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

impl<T> ToOwned for T
where T: Clone,

type Owned = T

The resulting type after obtaining ownership.

fn to_owned(&self) -> T

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

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

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

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.

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

Performs the conversion.

impl<T> WithSubscriber for T

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more

MIT License
Copyright © Tokio Contributors
https://docs.rs/tokio/1.53.1/tokio/io/struct.Interest.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API