pub struct CodeView<'a> { /* private fields */ }Expand description
A read-only, virtualized code view. See the module docs.
Implementations§
Source§impl<'a> CodeView<'a>
impl<'a> CodeView<'a>
pub fn new(id: &'a str, text: &'a str) -> Self
Sourcepub fn lang(self, lang: Option<&'a str>) -> Self
pub fn lang(self, lang: Option<&'a str>) -> Self
The language (a name, alias or extension; see ashlar_syntax::Lang::from_name). Unknown
or None shows plain text.
Sourcepub fn lang_for_path(self, path: &str) -> Self
pub fn lang_for_path(self, path: &str) -> Self
The language for a file path ("src/main.rs").
Sourcepub fn revision(self, revision: u64) -> Self
pub fn revision(self, revision: u64) -> Self
Bump when the text changes. (A change of the text’s address or length is noticed anyway; an edit that keeps both needs a new revision.)
Sourcepub fn wrap(self, wrap: bool) -> Self
pub fn wrap(self, wrap: bool) -> Self
Wrap long lines at the view’s width (off: long lines are clipped).
Sourcepub fn line_numbers(self, yes: bool) -> Self
pub fn line_numbers(self, yes: bool) -> Self
Show the line-number gutter (on by default).
Sourcepub fn theme(self, theme: &'a SyntaxTheme) -> Self
pub fn theme(self, theme: &'a SyntaxTheme) -> Self
Token colours (default: SyntaxTheme::from_tokens of the current tokens).
Sourcepub fn highlighter(self, h: &'a dyn Highlighter) -> Self
pub fn highlighter(self, h: &'a dyn Highlighter) -> Self
The highlighting engine (default: Builtin).
Sourcepub fn marks(self, marks: &'a [Range<usize>]) -> Self
pub fn marks(self, marks: &'a [Range<usize>]) -> Self
Byte ranges to mark (search hits), sorted by start and not overlapping.
Sourcepub fn scroll_to_line(self, line: Option<usize>) -> Self
pub fn scroll_to_line(self, line: Option<usize>) -> Self
Scroll so this line (0-based) is visible.
Sourcepub fn max_height(self, h: f32) -> Self
pub fn max_height(self, h: f32) -> Self
Cap the view’s height (default: the available height).
pub fn show(self, ui: &mut Ui) -> CodeViewResponse
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for CodeView<'a>
impl<'a> !Send for CodeView<'a>
impl<'a> !Sync for CodeView<'a>
impl<'a> !UnwindSafe for CodeView<'a>
impl<'a> Forget for CodeView<'a>
impl<'a> Freeze for CodeView<'a>
impl<'a> Move for CodeView<'a>
impl<'a> Unpin for CodeView<'a>
impl<'a> UnsafeUnpin for CodeView<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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