pub struct TranslationSessionConfiguration { /* private fields */ }Expand description
Serializable mirror of TranslationSession.Configuration from Translation.framework.
Implementations§
Source§impl TranslationSessionConfiguration
impl TranslationSessionConfiguration
Sourcepub fn new(source: impl Into<String>, target: impl Into<String>) -> Self
pub fn new(source: impl Into<String>, target: impl Into<String>) -> Self
Creates a session configuration from explicit source and target identifiers.
Sourcepub fn with_optional_target(
source: impl Into<String>,
target: Option<String>,
) -> Self
pub fn with_optional_target( source: impl Into<String>, target: Option<String>, ) -> Self
Creates a session configuration with an optional target identifier.
Sourcepub fn from_language_pair(pair: impl Into<LanguagePair>) -> Self
pub fn from_language_pair(pair: impl Into<LanguagePair>) -> Self
Creates a session configuration from a LanguagePair.
Sourcepub fn try_from_translation_configuration(
configuration: &TranslationConfiguration,
) -> Result<Self, TranslationError>
pub fn try_from_translation_configuration( configuration: &TranslationConfiguration, ) -> Result<Self, TranslationError>
Converts a TranslationConfiguration into a session configuration.
Sourcepub fn target(&self) -> &str
pub fn target(&self) -> &str
Returns the target identifier or an empty string when unspecified.
Sourcepub fn optional_target(&self) -> Option<&str>
pub fn optional_target(&self) -> Option<&str>
Returns the optional target language identifier.
Sourcepub const fn preferred_strategy(&self) -> TranslationStrategy
pub const fn preferred_strategy(&self) -> TranslationStrategy
Returns the preferred Translation.framework strategy.
Sourcepub fn with_preferred_strategy(
self,
preferred_strategy: TranslationStrategy,
) -> Self
pub fn with_preferred_strategy( self, preferred_strategy: TranslationStrategy, ) -> Self
Returns a copy with the given preferred strategy.
Sourcepub fn language_pair(&self) -> LanguagePair
pub fn language_pair(&self) -> LanguagePair
Returns this configuration as a LanguagePair.
Trait Implementations§
Source§impl Clone for TranslationSessionConfiguration
impl Clone for TranslationSessionConfiguration
Source§fn clone(&self) -> TranslationSessionConfiguration
fn clone(&self) -> TranslationSessionConfiguration
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'de> Deserialize<'de> for TranslationSessionConfiguration
impl<'de> Deserialize<'de> for TranslationSessionConfiguration
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 TranslationSessionConfiguration
impl PartialEq for TranslationSessionConfiguration
Source§fn eq(&self, other: &TranslationSessionConfiguration) -> bool
fn eq(&self, other: &TranslationSessionConfiguration) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for TranslationSessionConfiguration
impl StructuralPartialEq for TranslationSessionConfiguration
Auto Trait Implementations§
impl Freeze for TranslationSessionConfiguration
impl RefUnwindSafe for TranslationSessionConfiguration
impl Send for TranslationSessionConfiguration
impl Sync for TranslationSessionConfiguration
impl Unpin for TranslationSessionConfiguration
impl UnsafeUnpin for TranslationSessionConfiguration
impl UnwindSafe for TranslationSessionConfiguration
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