Skip to main content

Action

Enum Action 

Source
pub enum Action<L, T> {
    RegisterListener(Token, L),
    RegisterTransport(Token, T),
    UnregisterListener(Token),
    UnregisterTransport(Token),
    Send(Token, Vec<u8>),
    SetTimer(Duration),
}
Expand description

Actions which can be provided to the Reactor by the ReactionHandler.

Reactor reads actions on each event loop using ReactionHandler iterator interface.

Variants§

§

RegisterListener(Token, L)

Register a new listener resource for the reactor poll.

Reactor can’t instantiate the resource, like bind a network listener. Reactor only can register already active resource for polling in the event loop.

§

RegisterTransport(Token, T)

Register a new transport resource for the reactor poll.

Reactor can’t instantiate the resource, like open a file or establish network connection. Reactor only can register already active resource for polling in the event loop.

§

UnregisterListener(Token)

Unregister listener resource from the reactor poll and handover it to the ReactionHandler via ReactionHandler::handover_listener.

When the resource is unregistered no action is performed, i.e. the file descriptor is not closed, listener is not unbound, connections are not closed etc. All these actions must be handled by the handler upon the handover event.

§

UnregisterTransport(Token)

Unregister transport resource from the reactor poll and handover it to the ReactionHandler via ReactionHandler::handover_transport.

When the resource is unregistered no action is performed, i.e. the file descriptor is not closed, listener is not unbound, connections are not closed etc. All these actions must be handled by the handler upon the handover event.

§

Send(Token, Vec<u8>)

Write the data to one of the transport resources using io::Write.

§

SetTimer(Duration)

Set a new timer for a given duration from this moment.

When the timer elapses, the reactor will timeout from poll and call ReactionHandler::timer_reacted.

Trait Implementations§

Source§

impl<L: EventHandler, T: EventHandler> Display for Action<L, T>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<L, T> Freeze for Action<L, T>
where L: Freeze, T: Freeze,

§

impl<L, T> RefUnwindSafe for Action<L, T>

§

impl<L, T> Send for Action<L, T>
where L: Send, T: Send,

§

impl<L, T> Sync for Action<L, T>
where L: Sync, T: Sync,

§

impl<L, T> Unpin for Action<L, T>
where L: Unpin, T: Unpin,

§

impl<L, T> UnsafeUnpin for Action<L, T>
where L: UnsafeUnpin, T: UnsafeUnpin,

§

impl<L, T> UnwindSafe for Action<L, T>
where L: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T