[−][src]Struct outline::document::code::CodeBlock
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]
&self,
code_blocks: &HashMap<Option<&str>, CodeBlock<'a>>
) -> Result<String, CompileError>
"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]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,