lang_generator::generate_language!();
#[async_trait::async_trait]
pub trait AsyncTranslator: Send + Sync {
fn local(&self) -> bool;
#[allow(dead_code)]
async fn translate(
&self,
query: &str,
from: Option<Language>,
to: &Language,
) -> anyhow::Result<TranslationOutput>;
#[allow(dead_code)]
async fn translate_vec(
&self,
query: &[String],
from: Option<Language>,
to: &Language,
) -> anyhow::Result<TranslationListOutput>;
}
#[derive(Clone, Debug)]
#[allow(dead_code)]
pub struct TranslationOutput {
pub text: String,
pub lang: Option<Language>,
}
#[derive(Clone, Debug)]
pub struct TranslationListOutput {
pub text: Vec<String>,
pub lang: Option<Language>,
}