pub struct Heading {
pub level: u8,
pub id: String,
pub text: String,
pub start: usize,
}Expand description
One heading found by parsing a document, with the byte offset at which it begins.
See headings for why the offset is the useful part.
Fields§
§level: u8Heading level: 1 for #, 2 for ##, and so on.
id: StringThe id this heading gets, which is the id it can be linked by.
heading_id_from answers what it claims — its explicit {#id} when the
author wrote one, the slug of its text otherwise. This is that answer after
the two questions only the document can settle: an unnameable heading falls
back to its position, and a claim an earlier heading already took is
suffixed. See headings.
text: StringThe heading’s visible text, with the markup that produced it removed.
start: usizeByte offset into the source where this heading begins.
The heading’s own start, not its container’s: for > ## Quoted it
points at the #, past the blockquote marker. Callers use it to decide
which heading a later byte falls under, which is a comparison rather than
a slice, so what precedes it on the line does not concern them.
Trait Implementations§
impl Eq for Heading
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
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.