azure-speech 0.10.0

Pure Rust SDK for Azure Speech Service
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// src/callback.rs
use crate::RequestId;
use std::future::Future;
use std::pin::Pin;

pub(crate) type OnSessionStarted = Box<dyn Fn(RequestId) -> BoxFuture>;
pub(crate) type OnSessionEnded = Box<dyn Fn(RequestId) -> BoxFuture>;
pub(crate) type OnError = Box<dyn Fn(RequestId, crate::Error) -> BoxFuture>;
pub(crate) type BoxFuture = Pin<Box<dyn Future<Output = ()> + Send + 'static>>;

#[async_trait::async_trait]
pub trait Callback {
    type Item;
    fn on_event(&self, item: Self::Item) -> impl Future<Output = ()>;
}