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)
|=
operation. Read moreSource§impl Ord for Interest
impl Ord for Interest
Source§impl PartialOrd for Interest
impl PartialOrd 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,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 1 byte