Struct txtai::translation::Translation
source · pub struct Translation { /* private fields */ }
Expand description
Translation definition
Implementations§
source§impl Translation
impl Translation
Translation implementation
sourcepub fn new() -> Translation
pub fn new() -> Translation
Creates a Translation instance.
sourcepub fn with_url(url: &str) -> Translation
pub fn with_url(url: &str) -> Translation
sourcepub fn with_url_token(url: &str, token: &str) -> Translation
pub fn with_url_token(url: &str, token: &str) -> Translation
sourcepub async fn translate(
&self,
text: &str,
target: Option<&str>,
source: Option<&str>
) -> Strings
pub async fn translate( &self, text: &str, target: Option<&str>, source: Option<&str> ) -> Strings
Translates text from source language into target language.
§Arguments
text
text to translatetarget
target language code, defaults to “en”source
source language code, detects language if not provided
sourcepub async fn batchtranslate(
&self,
texts: &Vec<&str>,
target: Option<&str>,
source: Option<&str>
) -> StringsBatch
pub async fn batchtranslate( &self, texts: &Vec<&str>, target: Option<&str>, source: Option<&str> ) -> StringsBatch
Translates text from source language into target language.
§Arguments
texts
list of text to translatetarget
target language code, defaults to “en”source
source language code, detects language if not provided
Auto Trait Implementations§
impl Freeze for Translation
impl RefUnwindSafe for Translation
impl Send for Translation
impl Sync for Translation
impl Unpin for Translation
impl UnwindSafe for Translation
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