Function actress::spawn
[−]
[src]
pub fn spawn<T: Actor + Send + 'static>(contained: T) -> Sender<T::MessageType>
Spawns an actor with the given struct instance. Returns a channel Sender
to communicate
with the newly-spawned actor.
Examples
struct NullActor; impl actress::Actor for NullActor { type MessageType = i32; fn recv(&mut self, msg: i32) -> bool { msg == 42 } } fn main() { let null_actor = NullActor; let actor = actress::spawn(null_actor); }