pub struct Deepl { /* private fields */ }Implementations§
Source§impl Deepl
impl Deepl
pub fn new() -> Result<Self>
Sourcepub fn with_config<P: AsRef<Path>>(config_path: P) -> Result<Self>
pub fn with_config<P: AsRef<Path>>(config_path: P) -> Result<Self>
New DeepL instance from specific config file
Sourcepub async fn translate(
&self,
from_lang: Language,
to_lang: Language,
formality: Formality,
body: &str,
) -> Result<String>
pub async fn translate( &self, from_lang: Language, to_lang: Language, formality: Formality, body: &str, ) -> Result<String>
Translate single text string
pub async fn translate_strings( &self, from_lang: Language, to_lang: Language, formality: Formality, body: &Vec<&str>, ) -> Result<Vec<String>>
Sourcepub async fn translate_xml(
&self,
from_lang: Language,
to_lang: Language,
formality: Formality,
xml_body: &str,
) -> Result<String>
pub async fn translate_xml( &self, from_lang: Language, to_lang: Language, formality: Formality, xml_body: &str, ) -> Result<String>
Translate XML string
Sourcepub async fn register_glossaries<S: AsRef<str>>(
&self,
name: &str,
from_lang: Language,
to_lang: Language,
glossaries: &[(S, S)],
) -> Result<DeeplGlossary>
pub async fn register_glossaries<S: AsRef<str>>( &self, name: &str, from_lang: Language, to_lang: Language, glossaries: &[(S, S)], ) -> Result<DeeplGlossary>
Register new glossary
Sourcepub async fn list_glossaries(&self) -> Result<Vec<DeeplGlossary>>
pub async fn list_glossaries(&self) -> Result<Vec<DeeplGlossary>>
List registered glossaries
Sourcepub async fn remove_glossary(&self, id: &str) -> Result<()>
pub async fn remove_glossary(&self, id: &str) -> Result<()>
Remove registered glossaries
Auto Trait Implementations§
impl Freeze for Deepl
impl RefUnwindSafe for Deepl
impl Send for Deepl
impl Sync for Deepl
impl Unpin for Deepl
impl UnwindSafe for Deepl
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more