macro_rules! nautilus_actor {
($ty:ty) => { ... };
($ty:ty, $field:ident) => { ... };
}Expand description
Wires an actor type’s core field into the native runtime contract.
The struct must contain a field that provides a
DataActorCore reference, either directly or
by deref coercion through an intermediate core type (e.g. ExecutionAlgorithmCore).
By default the macro expects the field to be named core; pass a second argument
to use a different name.
The generated native access implementation is runtime wiring. Normal actor code
should use DataActor facade methods such as
actor_id(), trader_id(), config(), clock(), cache(), and the
subscription methods.
This macro only wires the data actor core. Components with a wider native core, such as execution algorithms, keep their component-specific core access behind their own native trait.
§Examples
use nautilus_common::{nautilus_actor, actor::DataActorCore};
pub struct MyActor {
core: DataActorCore,
// ...
}
nautilus_actor!(MyActor);With a custom field name:
pub struct MyActor {
actor_core: DataActorCore,
// ...
}
nautilus_actor!(MyActor, actor_core);