Trait arci::Speaker

source ·
pub trait Speaker: Send + Sync {
    // Required method
    fn speak(&self, message: &str) -> Result<WaitFuture, Error>;
}

Required Methods§

source

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.

Implementations on Foreign Types§

source§

impl<T: Speaker + ?Sized> Speaker for Box<T>where Box<T>: Send + Sync,

source§

fn speak(&self, message: &str) -> Result<WaitFuture, Error>

source§

impl<T: Speaker + ?Sized> Speaker for Arc<T>where Arc<T>: Send + Sync,

source§

fn speak(&self, message: &str) -> Result<WaitFuture, Error>

Implementors§

source§

impl Speaker for DummySpeaker

source§

impl<T> Speaker for Lazy<'_, T>where T: Speaker,