Struct rotor_stream::Persistent [] [src]

pub struct Persistent<P> where P: Protocol, P::Socket: ActiveStream(_, _, _);

Persistent client connection

TODO(tailhook) this should include name resolution

Methods

impl<P> Persistent<P> where P: Protocol, P::Socket: ActiveStream, P::Socket::Address: Debug

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

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

impl<P> Persistent<P> where P: Protocol, P::Socket: ActiveStream

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

fn protocol(&mut self) -> Option<&mut P>

Get a Protocol object for the stream

This method is only useful if you want to adjust protocol dysyr externally (like update some values after pushing data to buffer). Just be sure to wake up state machine if needed by the protocol.

Trait Implementations

impl<P: Protocol> Replaceable for Persistent<P> where P: Protocol, P::Seed: Clone, P::Socket::Address: Clone + Debug, P::Socket: ActiveStream

fn empty(&self) -> Self

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

impl<P: Protocol> Machine for Persistent<P> where P: Protocol, P::Seed: Clone, P::Socket: ActiveStream, P::Socket::Address: Debug

type Context = P::Context

type Seed = Void

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

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

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

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

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

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