pub struct CodeBlock {
pub span: Option<Span>,
/* private fields */
}Fields§
§span: Option<Span>Implementations§
Source§impl CodeBlock
impl CodeBlock
Sourcepub fn lang(&self) -> Option<SharedString>
pub fn lang(&self) -> Option<SharedString>
Get the language of the code block.
Sourcepub fn code(&self) -> SharedString
pub fn code(&self) -> SharedString
Get the code content of the code block.
Sourcepub fn from_code(
code: impl Into<SharedString>,
lang: Option<impl Into<SharedString>>,
) -> Self
pub fn from_code( code: impl Into<SharedString>, lang: Option<impl Into<SharedString>>, ) -> Self
Builds a code block that is not tied to a parsed document.
crate::TextView::code_block_highlighter hands a &CodeBlock to the
highlighter it is given, so anyone writing one needs a way to build a
block to exercise it against.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CodeBlock
impl RefUnwindSafe for CodeBlock
impl Send for CodeBlock
impl Sync for CodeBlock
impl Unpin for CodeBlock
impl UnsafeUnpin for CodeBlock
impl UnwindSafe for CodeBlock
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more