pub struct Paragraph {
pub lines: Vec<ContentItem>,
pub annotations: Vec<Annotation>,
pub location: Range,
}Expand description
A paragraph represents a block of text lines
Fields§
§lines: Vec<ContentItem>Lines stored as ContentItems (each a TextLine wrapping TextContent)
annotations: Vec<Annotation>§location: RangeImplementations§
Source§impl Paragraph
impl Paragraph
pub fn new(lines: Vec<ContentItem>) -> Self
pub fn from_line(line: String) -> Self
Sourcepub fn from_line_at(line: String, location: Range) -> Self
pub fn from_line_at(line: String, location: Range) -> Self
Create a paragraph with a single line and attach a location
pub fn text(&self) -> String
Sourcepub fn annotations(&self) -> &[Annotation]
pub fn annotations(&self) -> &[Annotation]
Annotations attached to this paragraph.
Sourcepub fn annotations_mut(&mut self) -> &mut Vec<Annotation>
pub fn annotations_mut(&mut self) -> &mut Vec<Annotation>
Mutable access to paragraph annotations.
Sourcepub fn iter_annotations(&self) -> Iter<'_, Annotation>
pub fn iter_annotations(&self) -> Iter<'_, Annotation>
Iterate over annotation blocks in source order.
Sourcepub fn iter_annotation_contents(&self) -> impl Iterator<Item = &ContentItem>
pub fn iter_annotation_contents(&self) -> impl Iterator<Item = &ContentItem>
Iterate over all content items nested inside attached annotations.
Trait Implementations§
Source§impl VisualStructure for Paragraph
impl VisualStructure for Paragraph
Source§fn collapses_with_children(&self) -> bool
fn collapses_with_children(&self) -> bool
Whether this is a homogeneous container whose children can collapse with parent icon Read more
Source§fn is_source_line_node(&self) -> bool
fn is_source_line_node(&self) -> bool
Whether this node corresponds to a line in the source document Read more
Source§fn has_visual_header(&self) -> bool
fn has_visual_header(&self) -> bool
Whether this node has a visual header line separate from its content Read more
impl StructuralPartialEq for Paragraph
Auto Trait Implementations§
impl Freeze for Paragraph
impl RefUnwindSafe for Paragraph
impl Send for Paragraph
impl Sync for Paragraph
impl Unpin for Paragraph
impl UnwindSafe for Paragraph
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more