pub struct TextAttributes {
pub start: usize,
pub end: usize,
pub effects: Vec<TextEffect>,
}
Expand description
Defines ranges of text and associated attributes parsed from typedstream
attributedBody
data.
Ranges specify locations where attributes are applied to specific portions of a Message
’s text
. For example, given message text with a Mention
like:
let message_text = "What's up, Christopher?";
There will be 3 ranges:
use imessage_database::message_types::text_effects::TextEffect;
use imessage_database::tables::messages::models::{TextAttributes, BubbleComponent};
let result = vec![BubbleComponent::Text(vec![
TextAttributes::new(0, 11, vec![TextEffect::Default]), // `What's up, `
TextAttributes::new(11, 22, vec![TextEffect::Mention("+5558675309".to_string())]), // `Christopher`
TextAttributes::new(22, 23, vec![TextEffect::Default]) // `?`
])];
Fields§
§start: usize
The start index of the affected range of message text
end: usize
The end index of the affected range of message text
effects: Vec<TextEffect>
The effects applied to the specified range
Implementations§
Source§impl TextAttributes
impl TextAttributes
Sourcepub fn new(start: usize, end: usize, effects: Vec<TextEffect>) -> Self
pub fn new(start: usize, end: usize, effects: Vec<TextEffect>) -> Self
Creates a new TextAttributes
with the specified start index, end index, and text effects.
Trait Implementations§
Source§impl Clone for TextAttributes
impl Clone for TextAttributes
Source§fn clone(&self) -> TextAttributes
fn clone(&self) -> TextAttributes
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 TextAttributes
impl Debug for TextAttributes
Source§impl PartialEq for TextAttributes
impl PartialEq for TextAttributes
impl Eq for TextAttributes
impl StructuralPartialEq for TextAttributes
Auto Trait Implementations§
impl Freeze for TextAttributes
impl RefUnwindSafe for TextAttributes
impl Send for TextAttributes
impl Sync for TextAttributes
impl Unpin for TextAttributes
impl UnwindSafe for TextAttributes
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.