pub struct Interest(/* private fields */);net, or tokio_unstable and Linux and crate feature fs and crate feature io-uring and crate feature rt only.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
impl Interest
Sourcepub const AIO: Interest
Available on FreeBSD and crate feature net only.
pub const AIO: Interest
net only.Interest for POSIX AIO.
Sourcepub const LIO: Interest
Available on FreeBSD and crate feature net only.
pub const LIO: Interest
net only.Interest for POSIX AIO lio_listio events.
Sourcepub 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.
pub const READABLE: Interest
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.
Sourcepub 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.
pub const WRITABLE: Interest
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.
Sourcepub 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.
pub const ERROR: Interest
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.
Sourcepub const PRIORITY: Interest
Available on Android or Linux only.
pub const PRIORITY: Interest
Returns a Interest set representing priority completion interests.
Sourcepub 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.
pub const fn is_readable(self) -> bool
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());Sourcepub 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.
pub const fn is_writable(self) -> bool
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());Sourcepub 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.
pub const fn is_error(self) -> bool
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());Sourcepub const fn is_priority(self) -> bool
Available on Android or Linux only.
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());Sourcepub 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.
pub const fn add(self, other: Interest) -> Interest
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());Sourcepub 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.
pub fn remove(self, other: Interest) -> Option<Interest>
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§
Source§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.
impl BitOr for Interest
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.Source§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.
impl BitOrAssign for Interest
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.Source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
|= operation. Read moreSource§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.
impl Clone for Interest
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 Copy for Interest
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.Source§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.
impl Debug for Interest
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 Eq for Interest
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.Source§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.
impl PartialEq for Interest
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 StructuralPartialEq for Interest
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.