pub struct AgentHandle<T> { /* private fields */ }Expand description
Handle to a spawned agent.
This is returned by spawn() and can be awaited to get the agent’s result.
Implementations§
Source§impl<T> AgentHandle<T>
impl<T> AgentHandle<T>
Sourcepub async fn result(self) -> SageResult<T>
pub async fn result(self) -> SageResult<T>
Wait for the agent to complete and return its result.
Source§impl<T> AgentHandle<T>
impl<T> AgentHandle<T>
Sourcepub async fn send<M>(&self, msg: M) -> SageResult<()>where
M: Serialize,
pub async fn send<M>(&self, msg: M) -> SageResult<()>where
M: Serialize,
Send a message to the agent.
The message will be serialized to JSON and placed in the agent’s mailbox.
Sourcepub async fn send_message(&self, message: Message) -> SageResult<()>
pub async fn send_message(&self, message: Message) -> SageResult<()>
Send a pre-built message to the agent.
This is used by generated code when the message needs additional metadata (like type_name for protocol tracking).
Auto Trait Implementations§
impl<T> Freeze for AgentHandle<T>
impl<T> RefUnwindSafe for AgentHandle<T>
impl<T> Send for AgentHandle<T>where
T: Send,
impl<T> Sync for AgentHandle<T>where
T: Send,
impl<T> Unpin for AgentHandle<T>
impl<T> UnsafeUnpin for AgentHandle<T>
impl<T> UnwindSafe for AgentHandle<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more