pub struct Interest(/* private fields */);
Expand description
Interest used in registering.
Interest are used in registering event::Source
s with Poll
, they
indicate what readiness should be monitored for. For example if a socket is
registered with readable interests and the socket becomes writable, no
event will be returned from a call to poll
.
Implementations§
source§impl Interest
impl Interest
sourcepub const PRIORITY: Interest = _
pub const PRIORITY: Interest = _
Returns a Interest
set representing priority completion interests.
sourcepub const fn add(self, other: Interest) -> Interest
pub const fn add(self, other: Interest) -> Interest
Add together two Interest
.
This does the same thing as the BitOr
implementation, but is a
constant function.
use mio::Interest;
const INTERESTS: Interest = Interest::READABLE.add(Interest::WRITABLE);
sourcepub fn remove(self, other: Interest) -> Option<Interest>
pub fn remove(self, other: Interest) -> Option<Interest>
Removes other
Interest
from self
.
Returns None
if the set would be empty after removing other
.
use mio::Interest;
const RW_INTERESTS: Interest = Interest::READABLE.add(Interest::WRITABLE);
// As long a one interest remain this will return `Some`.
let w_interest = RW_INTERESTS.remove(Interest::READABLE).unwrap();
assert!(!w_interest.is_readable());
assert!(w_interest.is_writable());
// Removing all interests from the set will return `None`.
assert_eq!(w_interest.remove(Interest::WRITABLE), None);
// Its also possible to remove multiple interests at once.
assert_eq!(RW_INTERESTS.remove(RW_INTERESTS), None);
sourcepub const fn is_readable(self) -> bool
pub const fn is_readable(self) -> bool
Returns true if the value includes readable readiness.
sourcepub const fn is_writable(self) -> bool
pub const fn is_writable(self) -> bool
Returns true if the value includes writable readiness.
sourcepub const fn is_priority(self) -> bool
pub const fn is_priority(self) -> bool
Returns true if Interest
contains priority readiness.
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)
Performs the
|=
operation. Read moresource§impl Ord for Interest
impl Ord for Interest
source§impl PartialEq for Interest
impl PartialEq for Interest
source§impl PartialOrd for Interest
impl PartialOrd for Interest
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Interest
impl Eq for Interest
impl StructuralEq for Interest
impl StructuralPartialEq for Interest
Auto Trait Implementations§
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
Mutably borrows from an owned value. Read more