Struct Persistent

Source
pub struct Persistent<P>(/* private fields */)
where
    P: Protocol,
    P::Socket: ActiveStream;
Expand description

Persistent client connection

TODO(tailhook) this should include name resolution

Implementations§

Source§

impl<P> Persistent<P>

Source

pub fn new<S: GenericScope>( _scope: &mut S, address: <P::Socket as ActiveStream>::Address, seed: P::Seed, ) -> Response<Persistent<P>, Void>

Source

pub fn connect<S: GenericScope>( scope: &mut S, address: <P::Socket as ActiveStream>::Address, seed: P::Seed, ) -> Response<Persistent<P>, Void>

Source§

impl<P> Persistent<P>

Source

pub fn transport(&mut self) -> Option<Transport<'_, P::Socket>>

Get a Transport object of the underlying stream

This method is only useful if you want to manipulate buffers externally (like pushing to the buffer from another thread). Just be sure to wake up state machine after manipulating buffers.

Returns None if stream is not currently connected

Trait Implementations§

Source§

impl<P> Machine for Persistent<P>

Source§

type Context = <P as Protocol>::Context

Context type for the state machine Read more
Source§

type Seed = Void

Seed is piece of data that is needed to initialize the machine Read more
Source§

fn create( seed: Self::Seed, _scope: &mut Scope<'_, P::Context>, ) -> Response<Self, Void>

Create a machine from some data Read more
Source§

fn ready( self, events: EventSet, scope: &mut Scope<'_, P::Context>, ) -> Response<Self, Self::Seed>

Socket readiness notification
Source§

fn spawned( self, _scope: &mut Scope<'_, P::Context>, ) -> Response<Self, Self::Seed>

Called after spawn event Read more
Source§

fn timeout( self, scope: &mut Scope<'_, P::Context>, ) -> Response<Self, Self::Seed>

Timeout happened
Source§

fn wakeup(self, scope: &mut Scope<'_, P::Context>) -> Response<Self, Self::Seed>

Message received Read more
Source§

fn spawn_error( self, _scope: &mut Scope<'_, Self::Context>, error: SpawnError<Self::Seed>, ) -> Response<Self, Self::Seed>

Called instead of spawned, if there is no slab space Read more
Source§

impl<P> Replaceable for Persistent<P>

Source§

fn empty(&self) -> Self

Return the empty value that may be used as replacement Read more
Source§

fn restart( self, _scope: &mut Scope<'_, Self::Context>, ) -> Response<Self, Self::Seed>

Restart a state machine from empty() state Read more

Auto Trait Implementations§

§

impl<P> Freeze for Persistent<P>
where <P as Protocol>::Socket: Sized + Freeze, <<P as Protocol>::Socket as ActiveStream>::Address: Freeze, <P as Protocol>::Seed: Freeze, P: Freeze,

§

impl<P> RefUnwindSafe for Persistent<P>

§

impl<P> Send for Persistent<P>
where <P as Protocol>::Socket: Sized + Send, <<P as Protocol>::Socket as ActiveStream>::Address: Send, <P as Protocol>::Seed: Send, P: Send,

§

impl<P> Sync for Persistent<P>
where <P as Protocol>::Socket: Sized + Sync, <<P as Protocol>::Socket as ActiveStream>::Address: Sync, <P as Protocol>::Seed: Sync, P: Sync,

§

impl<P> Unpin for Persistent<P>
where <P as Protocol>::Socket: Sized + Unpin, <<P as Protocol>::Socket as ActiveStream>::Address: Unpin, <P as Protocol>::Seed: Unpin, P: Unpin,

§

impl<P> UnwindSafe for Persistent<P>

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, 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.