pub struct TranslationAttributedString { /* private fields */ }Expand description
Rust-side attributed text wrapper for Translation.framework payloads.
Implementations§
Source§impl TranslationAttributedString
impl TranslationAttributedString
Sourcepub fn skip_translation_runs(&self) -> &[TranslationAttributedRun]
pub fn skip_translation_runs(&self) -> &[TranslationAttributedRun]
Returns the stored skip-translation runs.
Sourcepub fn set_text(&mut self, text: impl Into<String>)
pub fn set_text(&mut self, text: impl Into<String>)
Replaces the plain-text content and clears any stale runs.
Sourcepub fn add_skip_translation_run(
&mut self,
range: Range<usize>,
value: impl Into<SkipTranslationAttribute>,
) -> Result<(), TranslationError>
pub fn add_skip_translation_run( &mut self, range: Range<usize>, value: impl Into<SkipTranslationAttribute>, ) -> Result<(), TranslationError>
Adds a skip-translation run using character offsets.
Sourcepub fn add_skip_translation(
&mut self,
range: Range<usize>,
) -> Result<(), TranslationError>
pub fn add_skip_translation( &mut self, range: Range<usize>, ) -> Result<(), TranslationError>
Adds an enabled skip-translation run using character offsets.
Sourcepub fn with_skip_translation(
self,
range: Range<usize>,
) -> Result<Self, TranslationError>
pub fn with_skip_translation( self, range: Range<usize>, ) -> Result<Self, TranslationError>
Returns a copy with an enabled skip-translation run.
Sourcepub fn with_skip_translation_value(
self,
range: Range<usize>,
value: impl Into<SkipTranslationAttribute>,
) -> Result<Self, TranslationError>
pub fn with_skip_translation_value( self, range: Range<usize>, value: impl Into<SkipTranslationAttribute>, ) -> Result<Self, TranslationError>
Returns a copy with the provided skip-translation value.
Sourcepub fn add_skip_translation_for_substring(
&mut self,
substring: &str,
) -> Result<(), TranslationError>
pub fn add_skip_translation_for_substring( &mut self, substring: &str, ) -> Result<(), TranslationError>
Adds an enabled skip-translation run for the first matching substring.
Sourcepub fn with_skip_translation_for_substring(
self,
substring: &str,
) -> Result<Self, TranslationError>
pub fn with_skip_translation_for_substring( self, substring: &str, ) -> Result<Self, TranslationError>
Returns a copy with an enabled skip-translation run for the first matching substring.
Trait Implementations§
Source§impl Clone for TranslationAttributedString
impl Clone for TranslationAttributedString
Source§fn clone(&self) -> TranslationAttributedString
fn clone(&self) -> TranslationAttributedString
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 Debug for TranslationAttributedString
impl Debug for TranslationAttributedString
Source§impl Default for TranslationAttributedString
impl Default for TranslationAttributedString
Source§fn default() -> TranslationAttributedString
fn default() -> TranslationAttributedString
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for TranslationAttributedString
impl<'de> Deserialize<'de> for TranslationAttributedString
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 From<&str> for TranslationAttributedString
impl From<&str> for TranslationAttributedString
Source§impl From<String> for TranslationAttributedString
impl From<String> for TranslationAttributedString
Source§impl PartialEq for TranslationAttributedString
impl PartialEq for TranslationAttributedString
Source§fn eq(&self, other: &TranslationAttributedString) -> bool
fn eq(&self, other: &TranslationAttributedString) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for TranslationAttributedString
impl StructuralPartialEq for TranslationAttributedString
Auto Trait Implementations§
impl Freeze for TranslationAttributedString
impl RefUnwindSafe for TranslationAttributedString
impl Send for TranslationAttributedString
impl Sync for TranslationAttributedString
impl Unpin for TranslationAttributedString
impl UnsafeUnpin for TranslationAttributedString
impl UnwindSafe for TranslationAttributedString
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