Trait actix::prelude::actix::FramedActor
[−]
[src]
pub trait FramedActor: Actor { type Io: AsyncRead + AsyncWrite; type Codec: Encoder + Decoder; fn handle(
&mut self,
msg: Result<<Self::Codec as Decoder>::Item, <Self::Codec as Decoder>::Error>,
ctx: &mut Self::Context
); fn closed(&mut self) -> bool { ... } fn error(
&mut self,
err: <Self::Codec as Encoder>::Error,
ctx: &mut Self::Context
) { ... } fn framed<Addr>(self, io: Self::Io, codec: Self::Codec) -> Addr
where
Self: Actor<Context = FramedContext<Self>> + ActorAddress<Self, Addr>, { ... } fn from_framed<Addr>(self, framed: Framed<Self::Io, Self::Codec>) -> Addr
where
Self: Actor<Context = FramedContext<Self>> + ActorAddress<Self, Addr>, { ... } fn create_framed<Addr, F>(io: Self::Io, codec: Self::Codec, f: F) -> Addr
where
Self: Actor<Context = FramedContext<Self>> + ActorAddress<Self, Addr>,
F: FnOnce(&mut FramedContext<Self>) -> Self + 'static, { ... } fn create_from_framed<Addr, F>(
framed: Framed<Self::Io, Self::Codec>,
f: F
) -> Addr
where
Self: Actor<Context = FramedContext<Self>> + ActorAddress<Self, Addr>,
F: FnOnce(&mut FramedContext<Self>) -> Self + 'static, { ... } }
Actor trait that allows to handle tokio_io::codec::Framed
objects.
Associated Types
Required Methods
fn handle(
&mut self,
msg: Result<<Self::Codec as Decoder>::Item, <Self::Codec as Decoder>::Error>,
ctx: &mut Self::Context
)
&mut self,
msg: Result<<Self::Codec as Decoder>::Item, <Self::Codec as Decoder>::Error>,
ctx: &mut Self::Context
)
This message is called for every decoded message from framed object.
Provided Methods
fn closed(&mut self) -> bool
This method is called when framed object get closed.
Return value indicates continuation status. true
means stop actor,
false
conitnue to run actor
fn error(
&mut self,
err: <Self::Codec as Encoder>::Error,
ctx: &mut Self::Context
)
&mut self,
err: <Self::Codec as Encoder>::Error,
ctx: &mut Self::Context
)
Method is called on sink error. By default it does nothing.
fn framed<Addr>(self, io: Self::Io, codec: Self::Codec) -> Addr where
Self: Actor<Context = FramedContext<Self>> + ActorAddress<Self, Addr>,
Self: Actor<Context = FramedContext<Self>> + ActorAddress<Self, Addr>,
Start new actor, returns address of this actor.
fn from_framed<Addr>(self, framed: Framed<Self::Io, Self::Codec>) -> Addr where
Self: Actor<Context = FramedContext<Self>> + ActorAddress<Self, Addr>,
Self: Actor<Context = FramedContext<Self>> + ActorAddress<Self, Addr>,
Start new actor, returns address of this actor.
fn create_framed<Addr, F>(io: Self::Io, codec: Self::Codec, f: F) -> Addr where
Self: Actor<Context = FramedContext<Self>> + ActorAddress<Self, Addr>,
F: FnOnce(&mut FramedContext<Self>) -> Self + 'static,
Self: Actor<Context = FramedContext<Self>> + ActorAddress<Self, Addr>,
F: FnOnce(&mut FramedContext<Self>) -> Self + 'static,
This function starts new actor, returns address of this actor. Actor is created by factory function.
fn create_from_framed<Addr, F>(
framed: Framed<Self::Io, Self::Codec>,
f: F
) -> Addr where
Self: Actor<Context = FramedContext<Self>> + ActorAddress<Self, Addr>,
F: FnOnce(&mut FramedContext<Self>) -> Self + 'static,
framed: Framed<Self::Io, Self::Codec>,
f: F
) -> Addr where
Self: Actor<Context = FramedContext<Self>> + ActorAddress<Self, Addr>,
F: FnOnce(&mut FramedContext<Self>) -> Self + 'static,
This function starts new actor, returns address of this actor. Actor is created by factory function.