pub struct TextAnnotation {
pub start: u32,
pub end: u32,
pub kind: AnnotationKind,
}Expand description
A styling or semantic annotation that applies to a byte range within a node’s text.
Unlike DocumentNode, which captures block-level structure (headings, paragraphs, etc.),
a TextAnnotation describes inline-level markup — bold, italic, links, code spans, and
similar — that spans a contiguous run of bytes inside DocumentNode::content’s text field.
Byte offsets (start..end) are into the UTF-8 encoded text of the parent node. The range
is half-open: start is inclusive and end is exclusive.
Multiple annotations on the same node can overlap (e.g. bold-italic text), and they are stored in the order they are encountered during DOM traversal.
See AnnotationKind for the full list of supported annotation types.
Fields§
§start: u32Start byte offset (inclusive) into the parent node’s text.
end: u32End byte offset (exclusive) into the parent node’s text.
kind: AnnotationKindThe type of annotation.
Trait Implementations§
Source§impl Clone for TextAnnotation
impl Clone for TextAnnotation
Source§fn clone(&self) -> TextAnnotation
fn clone(&self) -> TextAnnotation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TextAnnotation
impl Debug for TextAnnotation
impl Eq for TextAnnotation
Source§impl PartialEq for TextAnnotation
impl PartialEq for TextAnnotation
Source§fn eq(&self, other: &TextAnnotation) -> bool
fn eq(&self, other: &TextAnnotation) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for TextAnnotation
Auto Trait Implementations§
impl Freeze for TextAnnotation
impl RefUnwindSafe for TextAnnotation
impl Send for TextAnnotation
impl Sync for TextAnnotation
impl Unpin for TextAnnotation
impl UnsafeUnpin for TextAnnotation
impl UnwindSafe for TextAnnotation
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
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.