pub struct Document { /* private fields */ }
Expand description
The root document itself, this contains a list of BlockContent
values as well as a list of
metadata properties.
Note that the add_
and set_
methods all return &mut Self
and so calls to these may be chained.
Implementations§
Source§impl Document
impl Document
Sourcepub fn has_metadata(&self) -> bool
pub fn has_metadata(&self) -> bool
Returns true
if this document has any associated metadata, else false
.
Sourcepub fn add_metadata(&mut self, datum: Metadata) -> &mut Self
pub fn add_metadata(&mut self, datum: Metadata) -> &mut Self
Add a metadata item to this document.
Sourcepub fn set_title(&mut self, v: &str) -> &mut Self
pub fn set_title(&mut self, v: &str) -> &mut Self
Set the title (metadata value) of this document.
Sourcepub fn set_date(&mut self, v: &str) -> &mut Self
pub fn set_date(&mut self, v: &str) -> &mut Self
Set the date (metadata value) of this document.
Add an author (metadata value) to this document.
Add an author (metadata value) to this document.
Sourcepub fn add_copyright(&mut self, v: Copyright) -> &mut Self
pub fn add_copyright(&mut self, v: Copyright) -> &mut Self
Add a copyright (metadata value) to this document.
Sourcepub fn add_copyright_str(
&mut self,
year: u16,
organization: Option<&str>,
comment: Option<&str>,
) -> &mut Self
pub fn add_copyright_str( &mut self, year: u16, organization: Option<&str>, comment: Option<&str>, ) -> &mut Self
Add a copyright (metadata value) to this document.
Sourcepub fn add_keywords(&mut self, v: &[String]) -> &mut Self
pub fn add_keywords(&mut self, v: &[String]) -> &mut Self
Add a list of keywords (metadata value) to this document.
Sourcepub fn add_keywords_str(&mut self, v: &[&str]) -> &mut Self
pub fn add_keywords_str(&mut self, v: &[&str]) -> &mut Self
Add a list of keywords (metadata value) to this document.
Sourcepub fn add_metadata_property(&mut self, v: SimpleProperty) -> &mut Self
pub fn add_metadata_property(&mut self, v: SimpleProperty) -> &mut Self
Add an arbitrary, named, metadata value)to this document.
Sourcepub fn add_metadata_property_str(
&mut self,
name: &str,
value: &str,
) -> &mut Self
pub fn add_metadata_property_str( &mut self, name: &str, value: &str, ) -> &mut Self
Add an arbitrary, named, metadata value)to this document.
Sourcepub fn has_abstract(&self) -> bool
pub fn has_abstract(&self) -> bool
Returns true
if an abstract has been added to this document, else false
.
Sourcepub fn add_abstract(&mut self, abstract_block: Paragraph) -> &mut Self
pub fn add_abstract(&mut self, abstract_block: Paragraph) -> &mut Self
Add a Paragraph
acting as the abstract to this document.
Sourcepub fn abstract_block(&self) -> &Option<Paragraph>
pub fn abstract_block(&self) -> &Option<Paragraph>
Return the Paragraph
, if present, acting as the abstract to this document.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Document
impl<'de> Deserialize<'de> for Document
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>,
Source§impl HasBlockContent for Document
impl HasBlockContent for Document
Source§fn from(inner: BlockContent) -> Self
fn from(inner: BlockContent) -> Self
Source§fn comment(inner: String) -> Self
fn comment(inner: String) -> Self
String
content item.Source§fn front_matter(matter: FrontMatter) -> Self
fn front_matter(matter: FrontMatter) -> Self
FrontMatter
content item.Source§fn heading(inner: Heading) -> Self
fn heading(inner: Heading) -> Self
Heading
content item.Source§fn image(inner: ImageBlock) -> Self
fn image(inner: ImageBlock) -> Self
ImageBlock
content item.Source§fn math(inner: MathBlock) -> Self
fn math(inner: MathBlock) -> Self
MathBlock
content item.Source§fn list(inner: List) -> Self
fn list(inner: List) -> Self
List
content item.Source§fn definition_list(inner: DefinitionList) -> Self
fn definition_list(inner: DefinitionList) -> Self
DefinitionList
content item.Source§fn formatted(inner: Formatted) -> Self
fn formatted(inner: Formatted) -> Self
Formatted
content item.Source§fn code_block(inner: CodeBlock) -> Self
fn code_block(inner: CodeBlock) -> Self
CodeBlock
content item.Source§fn paragraph(inner: Paragraph) -> Self
fn paragraph(inner: Paragraph) -> Self
Paragraph
content item.Source§fn block_quote(inner: Quote) -> Self
fn block_quote(inner: Quote) -> Self
Quote
content item.Source§fn table(inner: Table) -> Self
fn table(inner: Table) -> Self
Table
content item.Source§fn thematic_break() -> Self
fn thematic_break() -> Self
Source§fn add_comment_str(&mut self, inner: &str) -> &mut Self
fn add_comment_str(&mut self, inner: &str) -> &mut Self
Comment
to this container’s inner content.Source§fn add_front_matter(&mut self, matter: FrontMatter) -> &mut Self
fn add_front_matter(&mut self, matter: FrontMatter) -> &mut Self
FrontMatter
to this container’s inner content.Source§fn add_heading(&mut self, inner: Heading) -> &mut Self
fn add_heading(&mut self, inner: Heading) -> &mut Self
Heading
to this container’s inner content.Source§fn add_image(&mut self, inner: ImageBlock) -> &mut Self
fn add_image(&mut self, inner: ImageBlock) -> &mut Self
ImageBlock
to this container’s inner content.Source§fn add_math(&mut self, inner: MathBlock) -> &mut Self
fn add_math(&mut self, inner: MathBlock) -> &mut Self
MathBlock
to this container’s inner content.Source§fn add_list(&mut self, inner: List) -> &mut Self
fn add_list(&mut self, inner: List) -> &mut Self
List
to this container’s inner content.Source§fn add_definition_list(&mut self, inner: DefinitionList) -> &mut Self
fn add_definition_list(&mut self, inner: DefinitionList) -> &mut Self
DefinitionList
to this container’s inner content.Source§fn add_formatted(&mut self, inner: Formatted) -> &mut Self
fn add_formatted(&mut self, inner: Formatted) -> &mut Self
Formatted
to this container’s inner content.Source§fn add_code_block(&mut self, inner: CodeBlock) -> &mut Self
fn add_code_block(&mut self, inner: CodeBlock) -> &mut Self
CodeBlock
to this container’s inner content.Source§fn add_paragraph(&mut self, inner: Paragraph) -> &mut Self
fn add_paragraph(&mut self, inner: Paragraph) -> &mut Self
Paragraph
to this container’s inner content.Source§fn add_block_quote(&mut self, inner: Quote) -> &mut Self
fn add_block_quote(&mut self, inner: Quote) -> &mut Self
Quote
to this container’s inner content.Source§fn add_table(&mut self, inner: Table) -> &mut Self
fn add_table(&mut self, inner: Table) -> &mut Self
Table
to this container’s inner content.Source§fn add_thematic_break(&mut self) -> &mut Self
fn add_thematic_break(&mut self) -> &mut Self
ThematicBreak
to this container’s inner content.Source§impl HasInnerContent<BlockContent> for Document
impl HasInnerContent<BlockContent> for Document
Source§fn inner(&self) -> &Vec<BlockContent>
fn inner(&self) -> &Vec<BlockContent>
Source§fn into_inner(self) -> Vec<BlockContent>
fn into_inner(self) -> Vec<BlockContent>
self
.Source§fn inner_mut(&mut self) -> &mut Vec<BlockContent>
fn inner_mut(&mut self) -> &mut Vec<BlockContent>
Source§fn add_content(&mut self, content: BlockContent) -> Result<()>
fn add_content(&mut self, content: BlockContent) -> Result<()>
content
to the inner list of content. If there is some consistency condition that
would be broken by this addition an error will be returned.