How to handle the Parent Actor? #95
Replies: 2 comments 5 replies
-
|
I may be wrong but I think you have a cyclical to the parent type. Try instead to replace: with
|
Beta Was this translation helpful? Give feedback.
-
|
I had a brief look into this, and received the error about |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, me again :)
I'm trying to figure out how to pass to the child actor, the parent actor/reference.
The complexity is that I could have multiple implementations of the child for the same message. In the example posted, I have
crate::agents::agent1andcrate::agents::agent2(both implementMessage<agents::Commit>) that could be used on thecrate::assistant::Assistantactor. At the same time, I also have the recognizer actors that use the same concept.The currently posted example is not working, but I hope to give more insight into what I'm trying to achieve here.
Do you have any suggestions on how I could manage this situation?
Example Code
```rust use kameo::request::MessageSend; use std::time::Duration; use tracing::info; use tracing_subscriber::EnvFilter;pub(crate) mod manager {
use futures::future::BoxFuture;
use kameo::actor::ActorRef;
use kameo::mailbox::bounded::BoundedMailbox;
use kameo::message::{Context, Message};
use kameo::Actor;
use tracing::info;
}
pub(crate) mod recognizers {
pub struct Recognize(pub(crate) Vec);
}
pub(crate) mod thinkers {
use crate::manager;
pub struct Commit {
pub messages: Vecmanager::ManagerMessage,
pub id: usize,
}
}
#[tokio::main]
async fn main() -> Result<(), Box> {
tracing_subscriber::fmt()
.with_env_filter("trace".parse::().unwrap())
.without_time()
.with_target(false)
.init();
}
Beta Was this translation helpful? Give feedback.
All reactions