#[non_exhaustive]pub struct Translation {
pub translated_text: String,
pub model: String,
pub detected_language_code: String,
pub glossary_config: Option<TranslateTextGlossaryConfig>,
/* private fields */
}Expand description
A single translation response.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.translated_text: StringText translated into the target language. If an error occurs during translation, this field might be excluded from the response.
model: StringOnly present when model is present in the request.
model here is normalized to have project number.
For example:
If the model requested in TranslationTextRequest is
projects/{project-id}/locations/{location-id}/models/general/nmt then
model here would be normalized to
projects/{project-number}/locations/{location-id}/models/general/nmt.
detected_language_code: StringThe ISO-639 language code of source text in the initial request, detected automatically, if no source language was passed within the initial request. If the source language was passed, auto-detection of the language does not occur and this field is empty.
glossary_config: Option<TranslateTextGlossaryConfig>The glossary_config used for this translation.
Implementations§
Source§impl Translation
impl Translation
pub fn new() -> Self
Sourcepub fn set_translated_text<T: Into<String>>(self, v: T) -> Self
pub fn set_translated_text<T: Into<String>>(self, v: T) -> Self
Sets the value of translated_text.
§Example
let x = Translation::new().set_translated_text("example");Sourcepub fn set_detected_language_code<T: Into<String>>(self, v: T) -> Self
pub fn set_detected_language_code<T: Into<String>>(self, v: T) -> Self
Sets the value of detected_language_code.
§Example
let x = Translation::new().set_detected_language_code("example");Sourcepub fn set_glossary_config<T>(self, v: T) -> Selfwhere
T: Into<TranslateTextGlossaryConfig>,
pub fn set_glossary_config<T>(self, v: T) -> Selfwhere
T: Into<TranslateTextGlossaryConfig>,
Sets the value of glossary_config.
§Example
use google_cloud_translation_v3::model::TranslateTextGlossaryConfig;
let x = Translation::new().set_glossary_config(TranslateTextGlossaryConfig::default()/* use setters */);Sourcepub fn set_or_clear_glossary_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<TranslateTextGlossaryConfig>,
pub fn set_or_clear_glossary_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<TranslateTextGlossaryConfig>,
Sets or clears the value of glossary_config.
§Example
use google_cloud_translation_v3::model::TranslateTextGlossaryConfig;
let x = Translation::new().set_or_clear_glossary_config(Some(TranslateTextGlossaryConfig::default()/* use setters */));
let x = Translation::new().set_or_clear_glossary_config(None::<TranslateTextGlossaryConfig>);Trait Implementations§
Source§impl Clone for Translation
impl Clone for Translation
Source§fn clone(&self) -> Translation
fn clone(&self) -> Translation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more