pub struct MicrosoftTranslator { /* private fields */ }Expand description
微软翻译器实现
使用自动认证方式,通过临时token进行API调用。 不需要手动管理API密钥,系统会自动获取和刷新认证token。
Implementations§
Source§impl MicrosoftTranslator
impl MicrosoftTranslator
Sourcepub fn new(config: MicrosoftConfig) -> Self
pub fn new(config: MicrosoftConfig) -> Self
Trait Implementations§
Source§impl Translator for MicrosoftTranslator
impl Translator for MicrosoftTranslator
Source§fn translate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
target_lang: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn translate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
target_lang: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
翻译文本 (使用字符串语言代码) Read more
Source§fn translate_langid<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
target_lang: &'life2 LanguageIdentifier,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn translate_langid<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
target_lang: &'life2 LanguageIdentifier,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
翻译文本 (使用 LanguageIdentifier) Read more
Source§fn translate_with_langid<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
text: &'life1 str,
_source_lang: Option<&'life2 LanguageIdentifier>,
target_lang: &'life3 LanguageIdentifier,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn translate_with_langid<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
text: &'life1 str,
_source_lang: Option<&'life2 LanguageIdentifier>,
target_lang: &'life3 LanguageIdentifier,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
翻译文本 (指定源语言和目标语言) Read more
Auto Trait Implementations§
impl Freeze for MicrosoftTranslator
impl !RefUnwindSafe for MicrosoftTranslator
impl Send for MicrosoftTranslator
impl Sync for MicrosoftTranslator
impl Unpin for MicrosoftTranslator
impl !UnwindSafe for MicrosoftTranslator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more