pub struct ActrDispatch<W: Workload> { /* private fields */ }Expand description
Pure business dispatcher
Holds an Arc<W> workload instance and optional ACL rules,
exposing dispatch() and lifecycle methods.
Implementations§
Source§impl<W: Workload> ActrDispatch<W>
impl<W: Workload> ActrDispatch<W>
Sourcepub fn new(workload: Arc<W>, acl: Option<Acl>) -> Self
pub fn new(workload: Arc<W>, acl: Option<Acl>) -> Self
Create a dispatcher
§Arguments
workload: Business Workload instance (wrapped inArc)acl: Optional ACL rule set;Nonemeans all calls are allowed by default
Sourcepub async fn on_start<C: Context>(&self, ctx: &C) -> ActorResult<()>
pub async fn on_start<C: Context>(&self, ctx: &C) -> ActorResult<()>
Forward on_start lifecycle hook
Sourcepub async fn on_stop<C: Context>(&self, ctx: &C) -> ActorResult<()>
pub async fn on_stop<C: Context>(&self, ctx: &C) -> ActorResult<()>
Forward on_stop lifecycle hook
Sourcepub async fn dispatch<C: Context>(
&self,
self_id: &ActrId,
caller_id: Option<&ActrId>,
envelope: RpcEnvelope,
ctx: &C,
) -> ActorResult<Bytes>
pub async fn dispatch<C: Context>( &self, self_id: &ActrId, caller_id: Option<&ActrId>, envelope: RpcEnvelope, ctx: &C, ) -> ActorResult<Bytes>
Dispatch inbound message: ACL check -> routing -> handler execution
§Arguments
self_id: Current Actor’s IDcaller_id: Caller ID (Nonefor local calls)envelope: RPC envelope (contains route_key and payload)ctx: Execution context (generic, provided by upper layer)
§Returns
Serialized response bytes, or ActrError
Trait Implementations§
Source§impl<W: Workload> Clone for ActrDispatch<W>
impl<W: Workload> Clone for ActrDispatch<W>
Auto Trait Implementations§
impl<W> Freeze for ActrDispatch<W>
impl<W> RefUnwindSafe for ActrDispatch<W>where
W: RefUnwindSafe,
impl<W> Send for ActrDispatch<W>
impl<W> Sync for ActrDispatch<W>
impl<W> Unpin for ActrDispatch<W>
impl<W> UnsafeUnpin for ActrDispatch<W>
impl<W> UnwindSafe for ActrDispatch<W>where
W: RefUnwindSafe,
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