pub struct Heading {
pub level: u8,
pub text: String,
pub start_offset: usize,
pub end_offset: usize,
pub line_number: usize,
pub section_number: Option<String>,
}Expand description
A heading in a document (e.g., chapter, section, subsection)
Fields§
§level: u8Hierarchical level (1 = chapter/h1, 2 = section/h2, 3 = subsection/h3, etc.)
text: StringText content of the heading
start_offset: usizeStarting character offset in the original document
end_offset: usizeEnding character offset in the original document
line_number: usizeLine number in the document (if applicable)
section_number: Option<String>Optional section number (e.g., “1.2.3”, “Chapter 1”)
Implementations§
Source§impl Heading
impl Heading
Sourcepub fn new(
level: u8,
text: String,
start_offset: usize,
end_offset: usize,
) -> Self
pub fn new( level: u8, text: String, start_offset: usize, end_offset: usize, ) -> Self
Create a new heading
Sourcepub fn with_line_number(self, line_number: usize) -> Self
pub fn with_line_number(self, line_number: usize) -> Self
Create heading with line number
Sourcepub fn with_section_number(self, section_number: String) -> Self
pub fn with_section_number(self, section_number: String) -> Self
Create heading with section number
Sourcepub fn display_string(&self) -> String
pub fn display_string(&self) -> String
Get a display string for the heading
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Heading
impl<'de> Deserialize<'de> for Heading
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
impl StructuralPartialEq for Heading
Auto Trait Implementations§
impl Freeze for Heading
impl RefUnwindSafe for Heading
impl Send for Heading
impl Sync for Heading
impl Unpin for Heading
impl UnsafeUnpin for Heading
impl UnwindSafe for Heading
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