Struct ftd::p1::SubSection
source · [−]pub struct SubSection {
pub name: String,
pub caption: Option<String>,
pub header: Header,
pub body: Option<(usize, String)>,
pub is_commented: bool,
pub line_number: usize,
}
Fields
name: String
header: Header
body: Option<(usize, String)>
is_commented: bool
line_number: usize
Implementations
sourceimpl SubSection
impl SubSection
pub fn without_line_number(&self) -> Self
sourcepub fn remove_comments(&self) -> SubSection
pub fn remove_comments(&self) -> SubSection
returns a copy of SubSection after processing comments
NOTE: This function is only used by Section::remove_comments()
pub fn body(&self, doc_id: &str) -> Result<String>
returns tuple (body/caption, from_caption)
i.e it either returns
- (body, false)
- (caption, true)
In case both or none are passed then it throws error
pub fn with_name(name: &str) -> 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(self, key: &str, value: &Option<String>) -> Self
pub fn add_header_if_not_equal<T>(self, key: &str, value: T, reference: T) -> Self where
T: ToString + PartialEq,
pub fn and_body(self, body: &str) -> Self
pub fn and_optional_body(self, body: &Option<String>) -> Self
Trait Implementations
sourceimpl Clone for SubSection
impl Clone for SubSection
sourcefn clone(&self) -> SubSection
fn clone(&self) -> SubSection
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for SubSection
impl Debug for SubSection
sourceimpl Default for SubSection
impl Default for SubSection
sourcefn default() -> SubSection
fn default() -> SubSection
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for SubSection
impl<'de> Deserialize<'de> for SubSection
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 Display for SubSection
impl Display for SubSection
sourceimpl PartialEq<SubSection> for SubSection
impl PartialEq<SubSection> for SubSection
sourcefn eq(&self, other: &SubSection) -> bool
fn eq(&self, other: &SubSection) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourceimpl Serialize for SubSection
impl Serialize for SubSection
impl StructuralPartialEq for SubSection
Auto Trait Implementations
impl RefUnwindSafe for SubSection
impl Send for SubSection
impl Sync for SubSection
impl Unpin for SubSection
impl UnwindSafe for SubSection
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