Struct libretranslate::TranslationBuilder
source · pub struct TranslationBuilder {
pub url: String,
pub source: Language,
pub target: Language,
pub input: String,
/* private fields */
}
Expand description
Build Translations more verbosely.
Fields§
§url: String
§source: Language
§target: Language
§input: String
Implementations§
source§impl TranslationBuilder
impl TranslationBuilder
pub fn new() -> Self
pub fn url<T: AsRef<str>>(self, url: T) -> Self
pub fn from_lang(self, lang: Language) -> Self
pub fn to_lang(self, lang: Language) -> Self
pub fn text<T: AsRef<str>>(self, text: T) -> Self
pub fn key<T: AsRef<str>>(self, key: T) -> Self
pub async fn translate(self) -> Result<Translation, TranslateError>
Trait Implementations§
source§impl Clone for TranslationBuilder
impl Clone for TranslationBuilder
source§fn clone(&self) -> TranslationBuilder
fn clone(&self) -> TranslationBuilder
Returns a copy of the value. Read more
1.0.0 · 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 TranslationBuilder
impl Debug for TranslationBuilder
source§impl Default for TranslationBuilder
impl Default for TranslationBuilder
source§impl Hash for TranslationBuilder
impl Hash for TranslationBuilder
source§impl PartialEq<TranslationBuilder> for TranslationBuilder
impl PartialEq<TranslationBuilder> for TranslationBuilder
source§fn eq(&self, other: &TranslationBuilder) -> bool
fn eq(&self, other: &TranslationBuilder) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for TranslationBuilder
Auto Trait Implementations§
impl RefUnwindSafe for TranslationBuilder
impl Send for TranslationBuilder
impl Sync for TranslationBuilder
impl Unpin for TranslationBuilder
impl UnwindSafe for TranslationBuilder
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