pub struct TextAttributes<'a> {
pub start: usize,
pub end: usize,
pub effect: TextEffect<'a>,
}Expand description
Defines ranges of text and associated attributes parsed from typedstream attributedBody data.
Ranges specify locations attributes 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, TextEffect::Default), // `What's up, `
TextAttributes::new(11, 22, TextEffect::Mention("+5558675309")), // `Christopher`
TextAttributes::new(22, 23, TextEffect::Default) // `?`
])];Fields§
§start: usizeThe start index of the affected range of message text
end: usizeThe end index of the affected range of message text
effect: TextEffect<'a>The effects applied to the specified range
Implementations§
source§impl<'a> TextAttributes<'a>
impl<'a> TextAttributes<'a>
pub fn new(start: usize, end: usize, effect: TextEffect<'a>) -> Self
Trait Implementations§
source§impl<'a> Debug for TextAttributes<'a>
impl<'a> Debug for TextAttributes<'a>
source§impl<'a> PartialEq for TextAttributes<'a>
impl<'a> PartialEq for TextAttributes<'a>
impl<'a> Eq for TextAttributes<'a>
impl<'a> StructuralPartialEq for TextAttributes<'a>
Auto Trait Implementations§
impl<'a> Freeze for TextAttributes<'a>
impl<'a> RefUnwindSafe for TextAttributes<'a>
impl<'a> Send for TextAttributes<'a>
impl<'a> Sync for TextAttributes<'a>
impl<'a> Unpin for TextAttributes<'a>
impl<'a> UnwindSafe for TextAttributes<'a>
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<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.