pub struct GoogleTranslator { /* private fields */ }Expand description
Translator backend that calls the Google Cloud Translation v2 endpoint.
Uses API key authentication via the key query parameter.
The first 500,000 characters/month are free.
§Example
use psyche_subtitle_toolkit::GoogleTranslator;
let translator = GoogleTranslator::new("your-api-key")?;
// let result = translator.translate(request).await?;Implementations§
Trait Implementations§
Source§impl Clone for GoogleTranslator
impl Clone for GoogleTranslator
Source§fn clone(&self) -> GoogleTranslator
fn clone(&self) -> GoogleTranslator
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GoogleTranslator
impl Debug for GoogleTranslator
Source§impl Translator for GoogleTranslator
impl Translator for GoogleTranslator
Source§fn translate<'life0, 'life1, 'async_trait>(
&'life0 self,
request: TranslationRequest<'life1>,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn translate<'life0, 'life1, 'async_trait>(
&'life0 self,
request: TranslationRequest<'life1>,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Translate the source text and return the translated string. Read more
Auto Trait Implementations§
impl Freeze for GoogleTranslator
impl !RefUnwindSafe for GoogleTranslator
impl Send for GoogleTranslator
impl Sync for GoogleTranslator
impl Unpin for GoogleTranslator
impl UnsafeUnpin for GoogleTranslator
impl !UnwindSafe for GoogleTranslator
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