pub struct Stream<P: Protocol> { /* private fields */ }
Expand description
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.
Implementations§
Source§impl<P: Protocol> Stream<P>
impl<P: Protocol> Stream<P>
Sourcepub fn transport(&mut self) -> Transport<'_, P::Socket>
pub 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.
pub fn new( sock: P::Socket, seed: P::Seed, scope: &mut Scope<'_, P::Context>, ) -> Response<Self, Void>
pub fn connected( sock: P::Socket, seed: P::Seed, scope: &mut Scope<'_, P::Context>, ) -> Response<Self, Void>
Trait Implementations§
Source§impl<P: Protocol> Machine for Stream<P>
impl<P: Protocol> Machine for Stream<P>
Source§fn create(
void: Void,
_scope: &mut Scope<'_, Self::Context>,
) -> Response<Self, Void>
fn create( void: Void, _scope: &mut Scope<'_, Self::Context>, ) -> Response<Self, Void>
Create a machine from some data Read more
Source§fn ready(
self,
events: EventSet,
scope: &mut Scope<'_, Self::Context>,
) -> Response<Self, Self::Seed>
fn ready( self, events: EventSet, scope: &mut Scope<'_, Self::Context>, ) -> Response<Self, Self::Seed>
Socket readiness notification
Source§fn spawned(
self,
_scope: &mut Scope<'_, Self::Context>,
) -> Response<Self, Self::Seed>
fn spawned( self, _scope: &mut Scope<'_, Self::Context>, ) -> Response<Self, Self::Seed>
Called after spawn event Read more
Source§fn timeout(
self,
scope: &mut Scope<'_, Self::Context>,
) -> Response<Self, Self::Seed>
fn timeout( self, scope: &mut Scope<'_, Self::Context>, ) -> Response<Self, Self::Seed>
Timeout happened
Source§fn wakeup(
self,
scope: &mut Scope<'_, Self::Context>,
) -> Response<Self, Self::Seed>
fn wakeup( self, scope: &mut Scope<'_, Self::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>
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
Auto Trait Implementations§
impl<P> Freeze for Stream<P>
impl<P> RefUnwindSafe for Stream<P>
impl<P> Send for Stream<P>
impl<P> Sync for Stream<P>
impl<P> Unpin for Stream<P>
impl<P> UnwindSafe for Stream<P>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more