pub struct Code { /* private fields */ }Expand description
View that renders syntax-highlighted code snippets.
Implementations§
Source§impl Code
impl Code
Sourcepub fn new(
language: impl TryInto<Language, Error: Error>,
content: impl Into<Str>,
) -> Self
pub fn new( language: impl TryInto<Language, Error: Error>, content: impl Into<Str>, ) -> Self
Sourcepub fn info(self, info: impl Into<Str>) -> Self
pub fn info(self, info: impl Into<Str>) -> Self
Records the fence’s info token as the author wrote it.
Markdown calls this so a realization can claim a token no Language
answers to — mermaid, plantuml, vega — which would otherwise be
indistinguishable from a fence carrying no info string at all.
Sourcepub fn on_copied(self, callback: impl Fn(&Environment) + 'static) -> Self
pub fn on_copied(self, callback: impl Fn(&Environment) + 'static) -> Self
Runs after the block’s text has been copied to the clipboard.
Code owns the copy; what to tell the user about it is the caller’s —
a snackbar, a status line, nothing. Without one, copying is silent.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Code
impl !Send for Code
impl !Sync for Code
impl !UnwindSafe for Code
impl Freeze for Code
impl Unpin for Code
impl UnsafeUnpin for Code
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,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IdentifiableExt for T
impl<T> IdentifiableExt for T
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<V> PositionExt for Vwhere
V: View,
impl<V> PositionExt for Vwhere
V: View,
Source§fn position(
self,
x: impl IntoSignalF32,
y: impl IntoSignalF32,
) -> PositionedChild<Self>
fn position( self, x: impl IntoSignalF32, y: impl IntoSignalF32, ) -> PositionedChild<Self>
Position view’s center at absolute (x, y) coordinates. Read more
Source§fn position_anchor(
self,
anchor: UnitPoint,
x: impl IntoSignalF32,
y: impl IntoSignalF32,
) -> PositionedChild<Self>
fn position_anchor( self, anchor: UnitPoint, x: impl IntoSignalF32, y: impl IntoSignalF32, ) -> PositionedChild<Self>
Position view’s anchor point at absolute coordinates. Read more
Source§fn position_in(self, position: UnitPoint) -> PositionedChild<Self>
fn position_in(self, position: UnitPoint) -> PositionedChild<Self>
Position view’s center at fractional location in parent. Read more
Source§fn position_in_anchor(
self,
anchor: UnitPoint,
position: UnitPoint,
) -> PositionedChild<Self>
fn position_in_anchor( self, anchor: UnitPoint, position: UnitPoint, ) -> PositionedChild<Self>
Position view’s anchor at fractional location in parent. Read more
Source§fn position_in_offset(
self,
anchor: UnitPoint,
position: UnitPoint,
offset_x: impl IntoSignalF32,
offset_y: impl IntoSignalF32,
) -> PositionedChild<Self>
fn position_in_offset( self, anchor: UnitPoint, position: UnitPoint, offset_x: impl IntoSignalF32, offset_y: impl IntoSignalF32, ) -> PositionedChild<Self>
Position with fractional location plus offset. Read more
Source§fn pin(self, constraints: PinConstraints) -> PositionedChild<Self>
fn pin(self, constraints: PinConstraints) -> PositionedChild<Self>
Position using edge pins and optional explicit size. Read more