1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
use tokio_util::sync::CancellationToken; pub struct ActorSelf { cancel: CancellationToken, } impl ActorSelf { pub fn new(cancel: CancellationToken) -> Self { Self { cancel } } pub fn exit(&self) -> () { self.cancel.cancel(); } }