pub struct Section {
pub name: String,
pub caption: Option<String>,
pub header: Header,
pub body: Option<(usize, String)>,
pub sub_sections: SubSections,
pub is_commented: bool,
pub line_number: usize,
}Fields§
§name: String§caption: Option<String>§header: Header§body: Option<(usize, String)>§sub_sections: SubSections§is_commented: bool§line_number: usizeImplementations§
Source§impl Section
impl Section
Sourcepub fn remove_comments(&self) -> Section
pub fn remove_comments(&self) -> Section
returns a copy of Section after processing comments
§NOTE: This function is only called by ParsedDocument::ignore_comments()
pub fn caption(&self, line_number: usize, doc_id: &str) -> Result<String>
pub fn body(&self, line_number: usize, doc_id: &str) -> Result<String>
pub fn assert_missing( &self, line_number: usize, key: &str, doc_id: &str, ) -> Result<()>
pub fn with_name(name: &str) -> Self
pub fn without_line_number(&self) -> Self
pub fn and_caption(self, caption: &str) -> Self
pub fn and_optional_caption(self, value: &Option<Rendered>) -> Self
pub fn add_header(self, key: &str, value: &str) -> Self
pub fn add_optional_header_bool(self, key: &str, value: Option<bool>) -> Self
pub fn add_optional_header_i32(self, key: &str, value: &Option<i32>) -> Self
pub fn add_header_if_not_equal<T>( self, key: &str, value: T, reference: T, ) -> Self
pub fn add_optional_header(self, key: &str, value: &Option<String>) -> Self
pub fn and_body(self, body: &str) -> Self
pub fn and_optional_body(self, body: &Option<String>) -> Self
pub fn add_sub_section(self, sub: SubSection) -> Self
pub fn sub_sections_by_name(&self, name: &str) -> Vec<&SubSection>
pub fn sub_section_by_name( &self, name: &str, doc_id: String, ) -> Result<&SubSection>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Section
impl<'de> Deserialize<'de> for Section
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 Section
Auto Trait Implementations§
impl Freeze for Section
impl RefUnwindSafe for Section
impl Send for Section
impl Sync for Section
impl Unpin for Section
impl UnwindSafe for Section
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> 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