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>
[src]

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 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
[src]

type Seed = P::Seed

type Socket = P::Socket

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

The constructor of the state machine from the accepted connection

impl<P: Protocol> Machine for Stream<P>
[src]

type Context = P::Context

Context type for the state machine Read more

type Seed = Void

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

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

Create a machine from some data Read more

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

Socket readiness notification

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

Called after spawn event Read more

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

Timeout happened

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

Message received Read more

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

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

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

Formats the value using the given formatter.