Actor

We need a struct without any fields, because we'll use it with SyncArbiter, which runs multiple actors in multiple threads. Add the ResizeActor struct:

pub struct ResizeActor;

impl Actor for ResizeActor {
type Context = SyncContext<Self>;
}

We don't need a special constructor and we implemented the Actor trait with the SyncContext type for the associate  Context type. We'll use this context type to make this actor suitable for the synchronous environment of SyncArbiter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.42.176