pub struct WasmActor<R: Reactor> {
pub fuel_per_message: u64,
/* private fields */
}Expand description
An actor whose lifecycle hooks are implemented in a WASM module.
Construct via WasmActor::new and spawn with the normal ChildSpec
factory API. The actor creates its WASM instance lazily in on_start.
Fields§
§fuel_per_message: u64Fuel units granted per on_message call. 0 = use the instance default.
Implementations§
Source§impl<R: Reactor> WasmActor<R>
impl<R: Reactor> WasmActor<R>
Sourcepub fn new(
module: Arc<Box<dyn WasmModule>>,
host: Arc<dyn WasmHost>,
fuel_per_message: u64,
) -> Self
pub fn new( module: Arc<Box<dyn WasmModule>>, host: Arc<dyn WasmHost>, fuel_per_message: u64, ) -> Self
Create a new actor backed by module.
module— a compiled (but not yet instantiated) WASM module.host— the WASM runtime that will instantiate the module inon_start.fuel_per_message— fuel budget granted before eachon_messagecall. Use0to rely on the instance’s built-in default.
Trait Implementations§
Source§impl<R: Reactor> Actor<R> for WasmActor<R>
impl<R: Reactor> Actor<R> for WasmActor<R>
fn on_start(&mut self, _ctx: &mut ActorContext<R>) -> Result<(), ActorError>
fn on_message( &mut self, ctx: &mut ActorContext<R>, envelope: &Envelope, payload: MessagePayload, ) -> Result<(), ActorError>
fn on_stop(&mut self, _ctx: &mut ActorContext<R>, reason: StopReason)
impl<R: Reactor> Send for WasmActor<R>
Auto Trait Implementations§
impl<R> Freeze for WasmActor<R>
impl<R> !RefUnwindSafe for WasmActor<R>
impl<R> !Sync for WasmActor<R>
impl<R> Unpin for WasmActor<R>where
R: Unpin,
impl<R> UnsafeUnpin for WasmActor<R>
impl<R> !UnwindSafe for WasmActor<R>
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