macro_rules! entry {
($workload_type:ty) => { ... };
($workload_type:ty, $init_expr:expr) => { ... };
}Expand description
Generate Component Model exports for a Workload
type.
Platform ABI is auto-selected by target:
#[cfg(all(target_arch = "wasm32", not(feature = "web")))]— expands to animpl Guest for __ActrEntryAdapter { ... }bridging the user’sWorkloadinto theactr:workload/workloadexport contract. The runtime callsDispatcher::dispatchthrough thedispatchexport and every observation hook through its matching WIT export.#[cfg(all(target_arch = "wasm32", feature = "web"))]— expands to a#[wasm_bindgen(start)]bootstrap that wraps the user workload in aWebWorkloadAdapterand callsactr_web_abi::host::register_workload. Only the 17#[wasm_bindgen]entry points generated insideactr-web-abi::hostare exported to the Service Worker host.#[cfg(feature = "cdylib")]— expands to the legacyactr_init/actr_handle/actr_free_responseC-ABI exports used by native shared-library hosts.
§Arguments
$workload_type: type implementingactr_framework::Workload + Send + Sync + 'static.$init_expr(optional): expression returning a fresh instance of$workload_type. Defaults to<$workload_type as Default>::default().
§Usage
ⓘ
use actr_framework::entry;
entry!(EchoServiceWorkload<MyService>);
// Or with a custom constructor:
entry!(
EchoServiceWorkload<MyService>,
EchoServiceWorkload::new(MyService::new())
);