pub struct Translator {
pub source: String,
pub target: String,
pub engine: Engine,
pub proxies: Vec<Proxy>,
}
Expand description
A Translator
use deeptrans::Translator;
let mut translator = Translator::new();
let translation =
translator.translate("Texto a traducir").await;
println!("{translation}");
Fields§
§source: String
§target: String
§engine: Engine
§proxies: Vec<Proxy>
Implementations§
Source§impl Translator
impl Translator
pub fn new(source: &str, target: &str) -> Self
pub fn with_engine(source: &str, target: &str, engine: Engine) -> Self
pub async fn translate(&self, text: &str) -> Result<Value, Error>
Methods from Deref<Target = Engine>§
pub fn base_url(&self) -> String
pub fn name(&self) -> &str
pub fn supported_languages(&self) -> LanguagesToCodes
Trait Implementations§
Source§impl Clone for Translator
impl Clone for Translator
Source§fn clone(&self) -> Translator
fn clone(&self) -> Translator
Returns a duplicate 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 Translator
impl Debug for Translator
Source§impl Default for Translator
impl Default for Translator
Source§impl Deref for Translator
impl Deref for Translator
Source§impl DerefMut for Translator
impl DerefMut for Translator
Source§impl<'de> Deserialize<'de> for Translator
impl<'de> Deserialize<'de> for Translator
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for Translator
impl PartialEq for Translator
Source§impl Serialize for Translator
impl Serialize for Translator
impl Eq for Translator
Auto Trait Implementations§
impl Freeze for Translator
impl !RefUnwindSafe for Translator
impl Send for Translator
impl Sync for Translator
impl Unpin for Translator
impl !UnwindSafe for Translator
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.