#[non_exhaustive]pub struct Section<'a> {
pub metadata: BlockMetadata<'a>,
pub title: Title<'a>,
pub level: u8,
pub content: Vec<Block<'a>>,
pub location: Location,
}Expand description
A Section represents a section in a document.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.metadata: BlockMetadata<'a>§title: Title<'a>§level: u8§content: Vec<Block<'a>>§location: LocationImplementations§
Source§impl<'a> Section<'a>
impl<'a> Section<'a>
Sourcepub fn new(
title: Title<'a>,
level: u8,
content: Vec<Block<'a>>,
location: Location,
) -> Self
pub fn new( title: Title<'a>, level: u8, content: Vec<Block<'a>>, location: Location, ) -> Self
Create a new section with the given title, level, content, and location.
Sourcepub fn with_metadata(self, metadata: BlockMetadata<'a>) -> Self
pub fn with_metadata(self, metadata: BlockMetadata<'a>) -> Self
Set the metadata.
Source§impl<'a> Section<'a>
impl<'a> Section<'a>
Sourcepub fn generate_id_string(
metadata: &BlockMetadata<'a>,
title: &[InlineNode<'a>],
) -> String
pub fn generate_id_string( metadata: &BlockMetadata<'a>, title: &[InlineNode<'a>], ) -> String
Generate a section ID based on its title and metadata, returning a String
directly.
Returns the Display-formatted form (prefixed with _ for generated IDs)
matching safe_id.to_string().
Trait Implementations§
impl<'a> StructuralPartialEq for Section<'a>
Auto Trait Implementations§
impl<'a> Freeze for Section<'a>
impl<'a> RefUnwindSafe for Section<'a>
impl<'a> Send for Section<'a>
impl<'a> Sync for Section<'a>
impl<'a> Unpin for Section<'a>
impl<'a> UnsafeUnpin for Section<'a>
impl<'a> UnwindSafe for Section<'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