Struct rotor_stream::Stream [] [src]

pub struct Stream<P: Protocol> {
    // some fields omitted
}

A main stream state machine abstaction

You may use the Stream directly. But it's recommented to either use Persistent for client connections or Accept for server-side connection processing.

Methods

impl<P: Protocol> Stream<P>

fn transport(&mut self) -> Transport<P::Socket>

Get a Transport object for the 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.

fn protocol(&mut self) -> &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.

fn new(sock: P::Socket, seed: P::Seed, scope: &mut Scope<P::Context>) -> Response<Self, Void>

fn connected(sock: P::Socket, seed: P::Seed, scope: &mut Scope<P::Context>) -> Response<Self, Void>

Trait Implementations

impl<P: Protocol> Accepted for Stream<P> where P::Seed: Clone

type Seed = P::Seed

type Socket = P::Socket

fn accepted(sock: P::Socket, seed: P::Seed, scope: &mut Scope<Self::Context>) -> Response<Self, Void>

impl<P: Protocol> Machine for Stream<P>

type Context = P::Context

type Seed = Void

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

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

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

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

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

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

Derived Implementations

impl<P: Debug + Protocol> Debug for Stream<P> where P::Socket: Debug

fn fmt(&self, __arg_0: &mut Formatter) -> Result