pub struct LineNumbers<'a> { /* private fields */ }Expand description
Renders line-numbers.
§Stateful
This widget implements StatefulWidget, you can use it with
LineNumberState to handle common actions.
Implementations§
Source§impl<'a> LineNumbers<'a>
impl<'a> LineNumbers<'a>
pub fn new() -> LineNumbers<'a>
Sourcepub fn with_textarea(self, text_area: &'a TextAreaState) -> LineNumbers<'a>
pub fn with_textarea(self, text_area: &'a TextAreaState) -> LineNumbers<'a>
Sync with this text-area.
To make this work correctly, the TextArea must be rendered first to make sure that all layout-information stored in the state is accurate.
Sourcepub fn start(self, start: u32) -> LineNumbers<'a>
pub fn start(self, start: u32) -> LineNumbers<'a>
Start position.
Sourcepub fn end(self, end: u32) -> LineNumbers<'a>
pub fn end(self, end: u32) -> LineNumbers<'a>
End position.
Sourcepub fn cursor(self, cursor: u32) -> LineNumbers<'a>
pub fn cursor(self, cursor: u32) -> LineNumbers<'a>
Current line for highlighting.
Sourcepub fn relative(self, relative: bool) -> LineNumbers<'a>
pub fn relative(self, relative: bool) -> LineNumbers<'a>
Numbering relative to cursor
Sourcepub fn flags(self, flags: Vec<Line<'a>>) -> LineNumbers<'a>
pub fn flags(self, flags: Vec<Line<'a>>) -> LineNumbers<'a>
Extra info.
This is a Vec that matches up the visible lines.
Sourcepub fn flag_width(self, width: u16) -> LineNumbers<'a>
pub fn flag_width(self, width: u16) -> LineNumbers<'a>
Required width for the flags.
Sourcepub fn margin(self, margin: (u16, u16)) -> LineNumbers<'a>
pub fn margin(self, margin: (u16, u16)) -> LineNumbers<'a>
Extra margin as (left-margin, right-margin).
Sourcepub fn format(self, format: NumberFormat) -> LineNumbers<'a>
pub fn format(self, format: NumberFormat) -> LineNumbers<'a>
Line number format.
Sourcepub fn styles(self, styles: LineNumberStyle) -> LineNumbers<'a>
pub fn styles(self, styles: LineNumberStyle) -> LineNumbers<'a>
Complete set of styles.
Sourcepub fn style(self, style: Style) -> LineNumbers<'a>
pub fn style(self, style: Style) -> LineNumbers<'a>
Base style.
Sourcepub fn cursor_style(self, style: Style) -> LineNumbers<'a>
pub fn cursor_style(self, style: Style) -> LineNumbers<'a>
Style for current line.
Sourcepub fn block(self, block: Block<'a>) -> LineNumbers<'a>
pub fn block(self, block: Block<'a>) -> LineNumbers<'a>
Block.
Trait Implementations§
Source§impl<'a> Clone for LineNumbers<'a>
impl<'a> Clone for LineNumbers<'a>
Source§fn clone(&self) -> LineNumbers<'a>
fn clone(&self) -> LineNumbers<'a>
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<'a> Debug for LineNumbers<'a>
impl<'a> Debug for LineNumbers<'a>
Source§impl<'a> Default for LineNumbers<'a>
impl<'a> Default for LineNumbers<'a>
Source§fn default() -> LineNumbers<'a>
fn default() -> LineNumbers<'a>
Returns the “default value” for a type. Read more
Source§impl StatefulWidget for LineNumbers<'_>
impl StatefulWidget for LineNumbers<'_>
Source§type State = LineNumberState
type State = LineNumberState
State associated with the stateful widget. Read more
Source§fn render(
self,
area: Rect,
buf: &mut Buffer,
state: &mut <LineNumbers<'_> as StatefulWidget>::State,
)
fn render( self, area: Rect, buf: &mut Buffer, state: &mut <LineNumbers<'_> as StatefulWidget>::State, )
Draws the current state of the widget in the given buffer. That is the only method required
to implement a custom stateful widget.
Auto Trait Implementations§
impl<'a> Freeze for LineNumbers<'a>
impl<'a> !RefUnwindSafe for LineNumbers<'a>
impl<'a> !Send for LineNumbers<'a>
impl<'a> !Sync for LineNumbers<'a>
impl<'a> Unpin for LineNumbers<'a>
impl<'a> !UnwindSafe for LineNumbers<'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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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