Trait CodeBlock

Source
pub trait CodeBlock {
    // Required methods
    fn to_code_block(&self) -> String;
    fn to_code_block_with_language<S: AsRef<str>>(&self, language: S) -> String;
}
Expand description

An extension trait for code block transformations.

Required Methods§

Source

fn to_code_block(&self) -> String

Transforms the given text into a code block.

Source

fn to_code_block_with_language<S: AsRef<str>>(&self, language: S) -> String

Transforms the given text into a code block, allowing to specify the language to use for highlighting.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> CodeBlock for T
where T: AsRef<str>,