Struct somedoc::model::block::CodeBlock[][src]

pub struct CodeBlock { /* fields omitted */ }

A block of code, syntax highlighting may be used, especially if language is specified.

Implementations

impl CodeBlock[src]

pub fn with_language(code: &str, language: &str) -> Self[src]

Construct a new code block from the provided string ands language name.

pub fn code(&self) -> &String[src]

Return the inner code value as a string.

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

Set the code value for this block.

pub fn language(&self) -> &Option<String>[src]

Return the inner language name as a string, if present.

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

Set the language for this code block.

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

Set the language for this code block to None.

Trait Implementations

impl Clone for CodeBlock[src]

impl Debug for CodeBlock[src]

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

impl From<&'_ str> for CodeBlock[src]

impl From<String> for CodeBlock[src]

impl HasCaption for CodeBlock[src]

impl HasLabel for CodeBlock[src]

impl Into<BlockContent> for CodeBlock[src]

impl Serialize for CodeBlock[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.