pub struct AgentReply;Expand description
A utility namespace for creating standard return types for act_on message handlers.
Message handlers registered with ManagedAgent::act_on
typically need to return a future that is boxed and pinned, specifically [FutureBox].
This struct provides helpers to create common future types that might be needed
as part of that process.
It acts purely as a namespace and is not intended to be instantiated.
Implementations§
Source§impl AgentReply
impl AgentReply
Sourcepub fn immediate() -> Pin<Box<impl Future<Output = ()> + Sized>>
pub fn immediate() -> Pin<Box<impl Future<Output = ()> + Sized>>
Creates an immediately resolving, no-operation future, boxed and pinned.
This is useful for message handlers that perform synchronous work or do not need to perform any asynchronous operations after processing the message.
§Returns
A Pin<Box<impl Future<Output=()>>> that completes immediately. This can often
be coerced or converted into the required [FutureBox].
Sourcepub fn from_async<F>(future: F) -> Pin<Box<F>>
pub fn from_async<F>(future: F) -> Pin<Box<F>>
Wraps an existing future into a Pin<Box<F>>.
This method takes any future F with Output=() and boxes and pins it.
This is often a necessary step before potentially casting or using it where
a [FutureBox] is expected, provided F meets the Send + Sync + 'static bounds.
§Type Parameters
F: The type of the input future. Must haveOutput=().
§Arguments
future: The future to be wrapped.
§Returns
A Pin<Box<F>> containing the provided future.