Enum reactor::Action

source ·
pub enum Action<L: Resource, T: Resource> {
    RegisterListener(L),
    RegisterTransport(T),
    UnregisterListener(L::Id),
    UnregisterTransport(T::Id),
    Send(T::Id, Vec<u8>),
    SetTimer(Duration),
}
Expand description

Actions which can be provided to the reactor by the Handler.

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

Variants§

§

RegisterListener(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(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(L::Id)

Unregister listener resource from the reactor poll and handover it to the Handler via Handler::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(T::Id)

Unregister transport resource from the reactor poll and handover it to the Handler via Handler::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(T::Id, 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 fires reactor will timeout poll syscall and call Handler::handle_timer.

Trait Implementations§

source§

impl<L: Resource, T: Resource> 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> RefUnwindSafe for Action<L, T>where L: RefUnwindSafe, T: RefUnwindSafe, <L as Resource>::Id: RefUnwindSafe, <T as Resource>::Id: RefUnwindSafe,

§

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

§

impl<L, T> Sync for Action<L, T>where L: Sync, T: Sync, <L as Resource>::Id: Sync, <T as Resource>::Id: Sync,

§

impl<L, T> Unpin for Action<L, T>where L: Unpin, T: Unpin, <L as Resource>::Id: Unpin, <T as Resource>::Id: Unpin,

§

impl<L, T> UnwindSafe for Action<L, T>where L: UnwindSafe, T: UnwindSafe, <L as Resource>::Id: UnwindSafe, <T as Resource>::Id: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

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

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.