[][src]Struct outline::document::code::CodeBlock

pub struct CodeBlock<'a> {
    pub indent: &'a str,
    pub name: Option<String>,
    pub vars: Vec<&'a str>,
    pub language: Option<String>,
    pub source: Vec<Line<'a>>,
}

A CodeBlock is a block of code as defined by the input format.

Fields

indent: &'a str

The indent of this code block is in the documentation file

name: Option<String>

The name of this code block

vars: Vec<&'a str>

The variables extracted from the name

language: Option<String>

The language this block was written in

source: Vec<Line<'a>>

The source is the lines of code

Methods

impl<'a> CodeBlock<'a>[src]

pub fn new() -> Self[src]

Creates a new empty CodeBlock

pub fn indented(self, indent: &'a str) -> Self[src]

Indents this code block

pub fn named(self, name: String, vars: Vec<&'a str>) -> Self[src]

Names this code block

pub fn in_language(self, language: String) -> Self[src]

Sets the language of this code block

pub fn add_line(&mut self, line: Line<'a>)[src]

Adds a line to this code block

pub fn append(&mut self, other: &CodeBlock<'a>)[src]

Appends another code block to the end of this one

pub fn compile(
    &self,
    code_blocks: &HashMap<Option<&str>, CodeBlock<'a>>
) -> Result<String, CompileError>
[src]

"Compiles" this code block into its output code

pub fn line_number(&self) -> Option<usize>[src]

Returns the line number of the first line in this code block

Trait Implementations

impl<'a> Default for CodeBlock<'a>[src]

impl<'a> Clone for CodeBlock<'a>[src]

impl<'a> Debug for CodeBlock<'a>[src]

Auto Trait Implementations

impl<'a> Send for CodeBlock<'a>

impl<'a> Unpin for CodeBlock<'a>

impl<'a> Sync for CodeBlock<'a>

impl<'a> UnwindSafe for CodeBlock<'a>

impl<'a> RefUnwindSafe for CodeBlock<'a>

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

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

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

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.

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.

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

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

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