Paul Campbell
b7aa231925
All checks were successful
Rust / build (map[name:nightly]) (push) Successful in 7m32s
Rust / build (map[name:stable]) (push) Successful in 14m44s
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
Release Please / Release-plz (push) Successful in 1m14s
19 lines
508 B
Rust
19 lines
508 B
Rust
//
|
|
use kameo::{actor::ActorRef, Actor};
|
|
|
|
use crate::{spawn, spawn_in_thread};
|
|
|
|
/// Adds a spawn mathod to the actor.
|
|
pub trait BaseActor: Actor {
|
|
async fn spawn<Parent: Actor>(self, parent_actor_ref: ActorRef<Parent>) -> ActorRef<Self> {
|
|
spawn!(parent_actor_ref, self)
|
|
}
|
|
|
|
async fn spawn_in_thread<Parent: Actor>(
|
|
self,
|
|
parent_actor_ref: ActorRef<Parent>,
|
|
) -> ActorRef<Self> {
|
|
spawn_in_thread!(parent_actor_ref, self)
|
|
}
|
|
}
|
|
impl<T: Actor> BaseActor for T {}
|