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>
impl<P> Persistent<P>
pub fn new<S: GenericScope>( _scope: &mut S, address: <P::Socket as ActiveStream>::Address, seed: P::Seed, ) -> Response<Persistent<P>, Void>
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>
impl<P> Persistent<P>
Sourcepub fn transport(&mut self) -> Option<Transport<'_, P::Socket>>
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>where
P: Protocol,
P::Seed: Clone,
P::Socket: ActiveStream,
<P::Socket as ActiveStream>::Address: Debug,
impl<P> Machine for Persistent<P>where
P: Protocol,
P::Seed: Clone,
P::Socket: ActiveStream,
<P::Socket as ActiveStream>::Address: Debug,
Source§fn create(
seed: Self::Seed,
_scope: &mut Scope<'_, P::Context>,
) -> Response<Self, Void>
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>
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>
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>
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>
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>
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>where
P: Protocol,
P::Seed: Clone,
<P::Socket as ActiveStream>::Address: Clone + Debug,
P::Socket: ActiveStream,
impl<P> Replaceable for Persistent<P>where
P: Protocol,
P::Seed: Clone,
<P::Socket as ActiveStream>::Address: Clone + Debug,
P::Socket: ActiveStream,
Auto Trait Implementations§
impl<P> Freeze for Persistent<P>
impl<P> RefUnwindSafe for Persistent<P>where
<P as Protocol>::Socket: Sized + RefUnwindSafe,
<<P as Protocol>::Socket as ActiveStream>::Address: RefUnwindSafe,
<P as Protocol>::Seed: RefUnwindSafe,
P: RefUnwindSafe,
impl<P> Send for Persistent<P>
impl<P> Sync for Persistent<P>
impl<P> Unpin for Persistent<P>
impl<P> UnwindSafe for Persistent<P>where
<P as Protocol>::Socket: Sized + UnwindSafe,
<<P as Protocol>::Socket as ActiveStream>::Address: UnwindSafe,
<P as Protocol>::Seed: UnwindSafe,
P: UnwindSafe,
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