Struct actix::FramedContext
[−]
[src]
pub struct FramedContext<A> where
A: FramedActor + Actor<Context = FramedContext<A>>, { /* fields omitted */ }
Actor execution context for Framed object
Methods
impl<A> FramedContext<A> where
A: Actor<Context = Self> + FramedActor,
[src]
A: Actor<Context = Self> + FramedActor,
fn send(
&mut self,
msg: <A::Codec as Encoder>::Item
) -> Result<(), <A::Codec as Encoder>::Item>
[src]
&mut self,
msg: <A::Codec as Encoder>::Item
) -> Result<(), <A::Codec as Encoder>::Item>
Send item to sink. If sink is closed item returned as an error.
fn close(&mut self)
[src]
Gracefully close Framed object. FramedContext will try to send all buffered items and then close. FramedContext::stop() could be used to force stop sending process.
fn drain(&mut self) -> UnsyncReceiver<()>
[src]
Initiate sink drain
Returns oneshot future. It resolves when sink is drained. All other actor activities are paused.
fn take(&mut self) -> Option<Framed<A::Io, A::Codec>>
[src]
Get inner framed object
fn replace(&mut self, framed: Framed<A::Io, A::Codec>)
[src]
Replace existing framed object with new object.
Consider to use drain()
before replace framed object,
because Sink buffer get dropped as well.
Trait Implementations
impl<A> ToEnvelope<A> for FramedContext<A> where
A: FramedActor + Actor<Context = FramedContext<A>>,
[src]
A: FramedActor + Actor<Context = FramedContext<A>>,
fn pack<M>(
msg: M,
tx: Option<SyncSender<Result<M::Item, M::Error>>>,
cancel_on_drop: bool
) -> Envelope<A> where
M: ResponseType + Send + 'static,
A: Handler<M>,
A: FramedActor + Actor<Context = FramedContext<A>>,
M::Item: Send,
M::Error: Send,
[src]
msg: M,
tx: Option<SyncSender<Result<M::Item, M::Error>>>,
cancel_on_drop: bool
) -> Envelope<A> where
M: ResponseType + Send + 'static,
A: Handler<M>,
A: FramedActor + Actor<Context = FramedContext<A>>,
M::Item: Send,
M::Error: Send,
Pack message into suitable envelope
impl<A> ActorContext for FramedContext<A> where
A: Actor<Context = Self> + FramedActor,
[src]
A: Actor<Context = Self> + FramedActor,
fn stop(&mut self)
[src]
Stop actor execution
This method closes actor address and framed object.
fn terminate(&mut self)
[src]
Terminate actor execution
fn state(&self) -> ActorState
[src]
Actor execution state
fn alive(&self) -> bool
[src]
Check if execution context is alive
impl<A> AsyncContext<A> for FramedContext<A> where
A: Actor<Context = Self> + FramedActor,
[src]
A: Actor<Context = Self> + FramedActor,
fn spawn<F>(&mut self, fut: F) -> SpawnHandle where
F: ActorFuture<Item = (), Error = (), Actor = A> + 'static,
[src]
F: ActorFuture<Item = (), Error = (), Actor = A> + 'static,
Spawn async future into context. Returns handle of the item, could be used for cancelling execution. Read more
fn wait<F>(&mut self, fut: F) where
F: ActorFuture<Item = (), Error = (), Actor = A> + 'static,
[src]
F: ActorFuture<Item = (), Error = (), Actor = A> + 'static,
Spawn future into the context. Stop processing any of incoming events until this future resolves. Read more
fn cancel_future(&mut self, handle: SpawnHandle) -> bool
[src]
Cancel future. idx is a value returned by spawn
method.
fn cancel_future_on_stop(&mut self, handle: SpawnHandle)
[src]
fn address<Address>(&mut self) -> Address where
A: ActorAddress<A, Address>,
[src]
A: ActorAddress<A, Address>,
Get actor address
fn add_future<F>(&mut self, fut: F) where
F: Future + 'static,
F::Item: ResponseType,
A: Handler<Result<F::Item, F::Error>>,
[src]
F: Future + 'static,
F::Item: ResponseType,
A: Handler<Result<F::Item, F::Error>>,
This method allow to handle Future in similar way as normal actor messages. Read more
fn add_stream<S>(&mut self, fut: S) where
S: Stream + 'static,
S::Item: ResponseType,
A: StreamHandler<Result<S::Item, S::Error>>,
[src]
S: Stream + 'static,
S::Item: ResponseType,
A: StreamHandler<Result<S::Item, S::Error>>,
This method is similar to add_future
but works with streams. Read more
fn add_message_stream<S>(&mut self, fut: S) where
S: Stream<Error = ()> + 'static,
S::Item: ResponseType,
A: StreamHandler<S::Item>,
[src]
S: Stream<Error = ()> + 'static,
S::Item: ResponseType,
A: StreamHandler<S::Item>,
This method is similar to add_stream
but it skips errors.
fn notify<M>(&mut self, msg: M) where
A: Handler<M>,
M: ResponseType + 'static,
[src]
A: Handler<M>,
M: ResponseType + 'static,
Send message msg
to self.
fn notify_later<M>(&mut self, msg: M, after: Duration) -> SpawnHandle where
A: Handler<M>,
M: ResponseType + 'static,
[src]
A: Handler<M>,
M: ResponseType + 'static,
Send message msg
to self after specified period of time. Returns spawn handle which could be used for cancelation. Notification get cancelled if context's stop method get called. Read more
fn run_later<F>(&mut self, dur: Duration, f: F) -> SpawnHandle where
F: FnOnce(&mut A, &mut A::Context) + 'static,
[src]
F: FnOnce(&mut A, &mut A::Context) + 'static,
Execute closure after specified period of time within same Actor and Context Execution get cancelled if context's stop method get called. Read more
impl<A> AsyncContextApi<A> for FramedContext<A> where
A: Actor<Context = Self> + FramedActor,
[src]
A: Actor<Context = Self> + FramedActor,
fn address_cell(&mut self) -> &mut ActorAddressCell<A>
[src]
impl<A> Debug for FramedContext<A> where
A: Actor<Context = Self> + FramedActor,
[src]
A: Actor<Context = Self> + FramedActor,