Skip to content

Commit

Permalink
add method to accept already-instantated actor in actor handle
Browse files Browse the repository at this point in the history
  • Loading branch information
nand-nor committed Jan 10, 2025
1 parent f8f1918 commit 47e680b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ impl<T: Event + Send, S: ChannelTx<T>, R: ChannelRx<T>> ActorHandle<T, S, R> {
},
)
}

/// accept an actor that is already instantiated
pub fn new_with<A: Actor<T> + Sized + Unpin + 'static>(actor: A, sender: S) -> (A, Self) {
(
actor,
Self {
sender,
phantom: PhantomData,
},
)
}
}

pub struct SupervisedActorHandle<T: Event + Send> {
Expand Down

0 comments on commit 47e680b

Please sign in to comment.