nitinol_process/
process.rs

1use async_trait::async_trait;
2use nitinol_core::identifier::EntityId;
3use crate::{Context, Receptor};
4
5#[allow(unused_variables)]
6#[async_trait]
7pub trait Process: 'static + Sync + Send + Sized {
8    fn aggregate_id(&self) -> EntityId;
9    async fn start(&self, ctx: &mut Context) {}
10    async fn stop(&self, ctx: &mut Context) {}
11    
12    async fn as_ref_self(&self, ctx: &Context) -> Option<Receptor<Self>> {
13        ctx.find(&self.aggregate_id()).await
14    }
15}