fdeantoni / tiny-tokio-actor

A simple tiny actor library on top of Tokio
Apache License 2.0
68 stars 10 forks source link

Some missing parts #4

Open oblique opened 2 years ago

oblique commented 2 years ago

I really liked your crate and wanted to test it and even migrate to it from Actix.

I tried to migrate a small part but I found two missing parts:

  1. I couldn't find a way to get ActorRef of Actor itself or from its ActorContext.
  2. I couldn't find an equivalent to actix::Recipient.

Are they indeed missing?

fdeantoni commented 2 years ago

The actor Context does have the system, and from there you can use get_actor or get_or_create_actor.

There is no equivalent yet for actix::Recipient. I will see if I can add something similar. Pull requests are also welcome :)

dougcooper commented 1 year ago

came here to ask about this. I did discover the author's suggestion but a cleaner method would be cool.

let self_ref = _ctx.system.get_actor::<FooActor>(&_ctx.path).await.unwrap()

my use case is spawning a task in a call to handle which at some point in the future needs to ask/tell itself something.