pub struct Interest(/* private fields */);
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 READABLE: Interest = _
pub const READABLE: Interest = _
Interest in all readable events.
Readable interest includes read-closed events.
sourcepub const WRITABLE: Interest = _
pub const WRITABLE: Interest = _
Interest in all writable events.
Writable interest includes write-closed events.
sourcepub const ERROR: Interest = _
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.
sourcepub const PRIORITY: Interest = _
pub const PRIORITY: Interest = _
Returns a Interest
set representing priority completion interests.
sourcepub const fn is_readable(self) -> bool
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());
sourcepub const fn is_writable(self) -> bool
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());
sourcepub const fn is_error(self) -> bool
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());
sourcepub const fn is_priority(self) -> bool
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
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());
sourcepub fn remove(self, other: Interest) -> Option<Interest>
pub fn remove(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);
Trait Implementations§
source§impl BitOrAssign for Interest
impl BitOrAssign for Interest
source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
|=
operation. Read moresource§impl PartialEq for Interest
impl PartialEq for Interest
impl Copy for Interest
impl Eq for Interest
impl StructuralPartialEq for Interest
Auto Trait Implementations§
impl Freeze for Interest
impl RefUnwindSafe for Interest
impl Send for Interest
impl Sync for Interest
impl Unpin for Interest
impl UnwindSafe for Interest
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)