pub struct PreviewContent {
pub lines: Vec<String>,
pub highlight_line: Option<usize>,
pub syntax: Option<String>,
pub title: Option<String>,
pub styled_lines: Option<Vec<Vec<StyledSpan>>>,
}Expand description
Preview content for the selected item
Fields§
§lines: Vec<String>Lines of the preview content
highlight_line: Option<usize>Line to highlight (0-indexed)
syntax: Option<String>File extension for syntax highlighting
title: Option<String>Title for the preview panel
styled_lines: Option<Vec<Vec<StyledSpan>>>Styled spans per line (for syntax highlighting) Each inner Vec contains spans for one line, sorted by start position
Implementations§
Source§impl PreviewContent
impl PreviewContent
Sourcepub fn with_styled_lines(self, styled_lines: Vec<Vec<StyledSpan>>) -> Self
pub fn with_styled_lines(self, styled_lines: Vec<Vec<StyledSpan>>) -> Self
Set styled lines for syntax highlighting
Sourcepub const fn with_highlight_line(self, line: usize) -> Self
pub const fn with_highlight_line(self, line: usize) -> Self
Set the line to highlight
Sourcepub fn with_syntax(self, syntax: impl Into<String>) -> Self
pub fn with_syntax(self, syntax: impl Into<String>) -> Self
Set the syntax type
Sourcepub fn with_title(self, title: impl Into<String>) -> Self
pub fn with_title(self, title: impl Into<String>) -> Self
Set the preview title
Trait Implementations§
Source§impl Clone for PreviewContent
impl Clone for PreviewContent
Source§fn clone(&self) -> PreviewContent
fn clone(&self) -> PreviewContent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PreviewContent
impl Debug for PreviewContent
Source§impl Default for PreviewContent
impl Default for PreviewContent
Source§fn default() -> PreviewContent
fn default() -> PreviewContent
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PreviewContent
impl RefUnwindSafe for PreviewContent
impl Send for PreviewContent
impl Sync for PreviewContent
impl Unpin for PreviewContent
impl UnwindSafe for PreviewContent
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