Struct somedoc::model::document::Document[][src]

pub struct Document { /* fields omitted */ }
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

impl Document[src]

pub fn has_metadata(&self) -> bool[src]

Returns true if this document has any associated metadata, else false.

pub fn metadata(&self) -> &Vec<Metadata>[src]

Return the list of associated metadata.

pub fn add_metadata(&mut self, datum: Metadata) -> &mut Self[src]

Add a metadata item to this document.

pub fn set_title(&mut self, v: &str) -> &mut Self[src]

Set the title (metadata value) of this document.

pub fn set_date(&mut self, v: &str) -> &mut Self[src]

Set the date (metadata value) of this document.

pub fn add_author(&mut self, v: Author) -> &mut Self[src]

Add an author (metadata value) to this document.

pub fn add_author_str(
    &mut self,
    name: &str,
    email: Option<&str>,
    organization: Option<&str>
) -> &mut Self
[src]

Add an author (metadata value) to this document.

Add a copyright (metadata value) to this document.

Add a copyright (metadata value) to this document.

pub fn add_keywords(&mut self, v: &[String]) -> &mut Self[src]

Add a list of keywords (metadata value) to this document.

pub fn add_keywords_str(&mut self, v: &[&str]) -> &mut Self[src]

Add a list of keywords (metadata value) to this document.

pub fn add_metadata_property(&mut self, v: SimpleProperty) -> &mut Self[src]

Add an arbitrary, named, metadata value)to this document.

pub fn add_metadata_property_str(
    &mut self,
    name: &str,
    value: &str
) -> &mut Self
[src]

Add an arbitrary, named, metadata value)to this document.

pub fn has_abstract(&self) -> bool[src]

Returns true if an abstract has been added to this document, else false.

pub fn add_abstract(&mut self, abstract_block: Paragraph) -> &mut Self[src]

Add a Paragraph acting as the abstract to this document.

pub fn abstract_block(&self) -> &Option<Paragraph>[src]

Return the Paragraph, if present, acting as the abstract to this document.

Trait Implementations

impl Clone for Document[src]

fn clone(&self) -> Document[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Document[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for Document[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

impl<'de> Deserialize<'de> for Document[src]

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
    __D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl HasBlockContent for Document[src]

fn from(inner: BlockContent) -> Self[src]

Create a new block content container from the provided content item.

fn comment(inner: String) -> Self[src]

Create a new block content container from the provided String content item.

fn front_matter(matter: FrontMatter) -> Self[src]

Create a new block content container from the provided FrontMatter content item.

fn heading(inner: Heading) -> Self[src]

Create a new block content container from the provided Heading content item.

fn image(inner: ImageBlock) -> Self[src]

Create a new block content container from the provided ImageBlock content item.

fn math(inner: MathBlock) -> Self[src]

Create a new block content container from the provided MathBlock content item.

fn list(inner: List) -> Self[src]

Create a new block content container from the provided List content item.

fn definition_list(inner: DefinitionList) -> Self[src]

Create a new block content container from the provided DefinitionList content item.

fn formatted(inner: Formatted) -> Self[src]

Create a new block content container from the provided Formatted content item.

fn code_block(inner: CodeBlock) -> Self[src]

Create a new block content container from the provided CodeBlock content item.

fn paragraph(inner: Paragraph) -> Self[src]

Create a new block content container from the provided Paragraph content item.

fn block_quote(inner: Quote) -> Self[src]

Create a new block content container from the provided Quote content item.

fn table(inner: Table) -> Self[src]

Create a new block content container from the provided Table content item.

fn thematic_break() -> Self[src]

Create a new block content container with a thematic break.

fn add_comment_str(&mut self, inner: &str) -> &mut Self[src]

Add the provided Comment to this container’s inner content.

fn add_front_matter(&mut self, matter: FrontMatter) -> &mut Self[src]

Add the provided FrontMatter to this container’s inner content.

fn add_heading(&mut self, inner: Heading) -> &mut Self[src]

Add the provided Heading to this container’s inner content.

fn add_image(&mut self, inner: ImageBlock) -> &mut Self[src]

Add the provided ImageBlock to this container’s inner content.

fn add_math(&mut self, inner: MathBlock) -> &mut Self[src]

Add the provided MathBlock to this container’s inner content.

fn add_list(&mut self, inner: List) -> &mut Self[src]

Add the provided List to this container’s inner content.

fn add_definition_list(&mut self, inner: DefinitionList) -> &mut Self[src]

Add the provided DefinitionList to this container’s inner content.

fn add_formatted(&mut self, inner: Formatted) -> &mut Self[src]

Add the provided Formatted to this container’s inner content.

fn add_code_block(&mut self, inner: CodeBlock) -> &mut Self[src]

Add the provided CodeBlock to this container’s inner content.

fn add_paragraph(&mut self, inner: Paragraph) -> &mut Self[src]

Add the provided Paragraph to this container’s inner content.

fn add_block_quote(&mut self, inner: Quote) -> &mut Self[src]

Add the provided Quote to this container’s inner content.

fn add_table(&mut self, inner: Table) -> &mut Self[src]

Add the provided Table to this container’s inner content.

fn add_thematic_break(&mut self) -> &mut Self[src]

Add a ThematicBreak to this container’s inner content.

impl HasInnerContent<BlockContent> for Document[src]

fn inner(&self) -> &Vec<BlockContent>[src]

Return a reference to the inner value. Read more

fn into_inner(self) -> Vec<BlockContent>[src]

Return the inner value, consuming self. Read more

fn inner_mut(&mut self) -> &mut Vec<BlockContent>[src]

Return a mutable reference to the inner list of content. Read more

fn add_content(&mut self, content: BlockContent) -> Result<()>[src]

Add 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. Read more

fn has_inner(&self) -> bool[src]

Returns true if the inner list of content is not empty, else false. Read more

impl Into<Document> for BlockContent[src]

fn into(self) -> Document[src]

Performs the conversion.

impl Serialize for Document[src]

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
    __S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]