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
header: Header
body: Option<(usize, String)>
sub_sections: SubSections
is_commented: bool
line_number: usize
Implementations
sourceimpl 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 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 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 where
T: ToString + PartialEq,
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>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
pub fn sub_section_by_name(
&self,
name: &str,
doc_id: String
) -> Result<&SubSection>
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Section
impl<'de> Deserialize<'de> for Section
sourcefn 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
sourceimpl PartialEq<Section> for Section
impl PartialEq<Section> for Section
impl StructuralPartialEq for Section
Auto Trait Implementations
impl RefUnwindSafe for Section
impl Send for Section
impl Sync for Section
impl Unpin for Section
impl UnwindSafe for Section
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more