Struct Interest

pub struct Interest(/* private field */);

Interest used in registering.

Interest are used in registering event::Sources 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

impl Interest

const READABLE: Interest = _;

Returns a Interest set representing readable interests.

const WRITABLE: Interest = _;

Returns a Interest set representing writable interests.

const PRIORITY: Interest = _;

Returns a Interest set representing priority completion interests.

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);
# fn silent_dead_code_warning(_: Interest) { }
# silent_dead_code_warning(INTERESTS)
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);
const fn is_readable(self) -> bool

Returns true if the value includes readable readiness.

const fn is_writable(self) -> bool

Returns true if the value includes writable readiness.

const fn is_aio(self) -> bool

Returns true if Interest contains AIO readiness.

const fn is_lio(self) -> bool

Returns true if Interest contains LIO readiness.

const fn is_priority(self) -> bool

Returns true if Interest contains priority readiness.

Trait Implementations

impl BitOr for Interest

type Output = Interest;
fn bitor(self, other: Self) -> Self

impl BitOrAssign for Interest

fn bitor_assign(&mut self, other: Self)

impl Clone for Interest

fn clone(&self) -> Interest

impl Copy for Interest

impl Debug for Interest

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

impl Eq for Interest

impl Ord for Interest

fn cmp(&self, other: &Interest) -> Ordering

impl PartialEq for Interest

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

impl PartialOrd for Interest

fn partial_cmp(&self, other: &Interest) -> Option<Ordering>

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 UnsafeUnpin for Interest

impl UnwindSafe for Interest

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

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

impl<T> From<T> for Interest

fn from(t: T) -> T

Returns the argument unchanged.

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

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for Interest 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, U> TryFrom<U> for Interest where U: Into<T>,

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

impl<T, U> TryInto<U> for Interest where U: TryFrom<T>,

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