pub trait Speaker: Send + Sync {
// Required method
fn speak(&self, message: &str) -> Result<WaitFuture, Error>;
}
Required Methods§
sourcefn speak(&self, message: &str) -> Result<WaitFuture, Error>
fn speak(&self, message: &str) -> Result<WaitFuture, Error>
Starts speaking and returns a future that waits until complete the speaking.
§Implementation
The returned future is expected to behave similarly to
std::thread::JoinHandle
and tokio::task::JoinHandle
:
- Can wait for the operation to complete by
.await
. - The operation does not end even if it is dropped.
If the operation may block the current thread for an extended period of time, consider spawning a thread to running blocking operations.