pub struct CodeView { /* private fields */ }Expand description
Read-only code with a gutter.
Implementations§
Source§impl CodeView
impl CodeView
pub fn new( ident: impl Into<Ident>, lines: impl IntoIterator<Item = CodeLine>, ) -> Self
Sourcepub fn from_text(ident: impl Into<Ident>, text: &str) -> Self
pub fn from_text(ident: impl Into<Ident>, text: &str) -> Self
Splits plain text into numbered lines starting at 1.
A convenience over CodeView::new and nothing more: it classifies
nothing and marks nothing.
Sourcepub fn language(self, language: impl Into<SharedString>) -> Self
pub fn language(self, language: impl Into<SharedString>) -> Self
The language’s name, shown as written. Nothing here reads it.
pub fn line_numbers(self, line_numbers: bool) -> Self
Sourcepub fn visible_lines(self, lines: usize) -> Self
pub fn visible_lines(self, lines: usize) -> Self
Bounds the viewport to lines rows and virtualizes the body.
Horizontal scrolling goes with it; see the module documentation.
Trait Implementations§
Source§impl IntoElement for CodeView
impl IntoElement for CodeView
Source§type Element = ViewElement<CodeView>
type Element = ViewElement<CodeView>
The specific type of element into which the implementing type is converted.
Useful for converting other types into elements automatically, like Strings
Source§fn into_element(self) -> Self::Element
fn into_element(self) -> Self::Element
Convert self into a type that implements
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
Convert self into a dynamically-typed
AnyElement.Source§impl RenderOnce for CodeView
impl RenderOnce for CodeView
Source§fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement
fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement
Render this component into an element tree. Note that this method
takes ownership of self, as compared to
Render::render() method
which takes a mutable reference.Source§impl Sizable for CodeView
impl Sizable for CodeView
Source§fn control_size(self, _size: ControlSize) -> Self
fn control_size(self, _size: ControlSize) -> Self
Accepted for uniformity with every other component; the code itself is
set from the code typographic step whatever this says, because a code
listing that changed size with a button would stop being comparable
with the one beside it.
fn xs(self) -> Self
fn small(self) -> Self
fn medium(self) -> Self
fn large(self) -> Self
Auto Trait Implementations§
impl Freeze for CodeView
impl RefUnwindSafe for CodeView
impl Send for CodeView
impl Sync for CodeView
impl Unpin for CodeView
impl UnsafeUnpin for CodeView
impl UnwindSafe for CodeView
Blanket Implementations§
Source§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
Source§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Render this component or element with an animation
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<E> Flipping for Ewhere
E: IntoElement,
impl<E> Flipping for Ewhere
E: IntoElement,
Source§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Imperatively modify self with the given closure.
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Conditionally modify self with the given closure.
Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
Conditionally modify self with the given closure.
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