pub struct CodeEditor { /* private fields */ }Expand description
Represents the text editor, which holds the code buffer, cursor, selection, theme, scroll offsets, highlight cache, clipboard, and user mark intervals.
Implementations§
Source§impl Editor
impl Editor
Sourcepub fn new(
lang: &str,
text: &str,
theme: Vec<(&str, &str)>,
) -> Result<Editor, Error>
pub fn new( lang: &str, text: &str, theme: Vec<(&str, &str)>, ) -> Result<Editor, Error>
Create an editor for the given language, text, and syntax theme.
§Errors
Returns an error when neither the requested language grammar nor the
text fallback grammar can be loaded.
Sourcepub fn new_with_highlights(
lang: &str,
text: &str,
theme: Vec<(&str, &str)>,
custom_highlights: Option<HashMap<String, String>>,
) -> Result<Editor, Error>
pub fn new_with_highlights( lang: &str, text: &str, theme: Vec<(&str, &str)>, custom_highlights: Option<HashMap<String, String>>, ) -> Result<Editor, Error>
Create an editor with optional custom highlight overrides.
§Errors
Returns an error when neither the requested language grammar nor the
text fallback grammar can be loaded.
Sourcepub fn set_text_style(&mut self, style: Style)
pub fn set_text_style(&mut self, style: Style)
Set the style for ordinary text (the foreground of unhighlighted code).
Sourcepub fn set_line_number_style(&mut self, style: Style)
pub fn set_line_number_style(&mut self, style: Style)
Set the style for the line-number gutter.
Sourcepub fn set_relative_line_numbers(&mut self, on: bool)
pub fn set_relative_line_numbers(&mut self, on: bool)
Enable or disable relative (hybrid) line numbering.
Sourcepub fn set_cursor_style(&mut self, style: Option<Style>)
pub fn set_cursor_style(&mut self, style: Option<Style>)
Set the block-cursor style. Pass Some(style) to draw a visible cursor
cell (its bg is the cursor color), or None to draw no cursor.
Sourcepub fn set_syntax_theme(&mut self, theme: &[(&str, &str)])
pub fn set_syntax_theme(&mut self, theme: &[(&str, &str)])
Replace the syntax-highlight theme (token name -> #rrggbb) and drop the
cached highlights so the new colors take effect on the next render.
Sourcepub fn set_selection_style(&mut self, style: Style)
pub fn set_selection_style(&mut self, style: Style)
Set the style applied to the active selection.
Sourcepub fn handle_mouse_down(&mut self, cursor: usize)
pub fn handle_mouse_down(&mut self, cursor: usize)
Handles a mouse button press at the given cursor position, updating selection and click state.
Sourcepub fn handle_mouse_drag(&mut self, cursor: usize)
pub fn handle_mouse_drag(&mut self, cursor: usize)
Handles a mouse drag event at the given cursor position, extending the selection.
Sourcepub fn cursor_from_mouse(
&self,
mouse_x: u16,
mouse_y: u16,
area: &Rect,
) -> Option<usize>
pub fn cursor_from_mouse( &self, mouse_x: u16, mouse_y: u16, area: &Rect, ) -> Option<usize>
Converts mouse coordinates to a cursor position within the editor area, returning None if outside.
Sourcepub fn clear_selection(&mut self)
pub fn clear_selection(&mut self)
Clears any active selection.
Sourcepub fn extend_selection(&mut self, new_cursor: usize)
pub fn extend_selection(&mut self, new_cursor: usize)
Extends or starts a selection from the current cursor to new_cursor.
Sourcepub fn selection_anchor(&self) -> usize
pub fn selection_anchor(&self) -> usize
Returns the selection anchor position, or the cursor if no selection exists.
Sourcepub fn set_content(&mut self, content: &str)
pub fn set_content(&mut self, content: &str)
Replace the entire buffer contents with content as a single undo step.
Sourcepub fn apply_batch(&mut self, batch: &EditBatch)
pub fn apply_batch(&mut self, batch: &EditBatch)
Apply a batch of edits as a single undo step.
Sourcepub fn set_cursor(&mut self, cursor: usize)
pub fn set_cursor(&mut self, cursor: usize)
Move the cursor to the given char offset, clamped to the buffer. Clears the vertical-movement goal column; line up/down re-establish it afterward.
Sourcepub fn set_selection_range(&mut self, anchor: usize, cursor: usize)
pub fn set_selection_range(&mut self, anchor: usize, cursor: usize)
Select the range [anchor, cursor), putting the caret at cursor. An
empty range (anchor == cursor) just clears the selection.
Sourcepub fn fit_cursor(&mut self)
pub fn fit_cursor(&mut self)
Clamp the cursor so it stays within the buffer and its current line.
Sourcepub fn scroll_down(&mut self, area_height: usize)
pub fn scroll_down(&mut self, area_height: usize)
Scroll the viewport down one line, bounded by the last line.
Sourcepub fn get_content(&self) -> String
pub fn get_content(&self) -> String
Return the entire buffer contents as an owned string.
Sourcepub fn get_content_slice(&self, start: usize, end: usize) -> String
pub fn get_content_slice(&self, start: usize, end: usize) -> String
Return the text of the char range [start, end) as an owned string.
Sourcepub fn get_cursor(&self) -> usize
pub fn get_cursor(&self) -> usize
Return the cursor’s char offset.
Sourcepub fn cursor_line(&self) -> usize
pub fn cursor_line(&self) -> usize
The 0-based line (row) the cursor is on.
Sourcepub fn comment_prefix(&self) -> String
pub fn comment_prefix(&self) -> String
The line-comment prefix for this buffer’s language (e.g. // or #).
Sourcepub fn set_cursor_line(&mut self, line: usize)
pub fn set_cursor_line(&mut self, line: usize)
Move the cursor to the start of 0-based line (clamped to the buffer) and
clear any selection.
Sourcepub fn set_clipboard(&mut self, text: &str) -> Result<(), Error>
pub fn set_clipboard(&mut self, text: &str) -> Result<(), Error>
Set the clipboard text, falling back to an in-memory clipboard when the system clipboard is unavailable.
§Errors
Currently always returns Ok; the system-clipboard failure path falls
back to the in-memory clipboard.
Sourcepub fn get_clipboard(&self) -> Result<String, Error>
pub fn get_clipboard(&self) -> Result<String, Error>
Return the clipboard text, preferring the system clipboard and falling back to the in-memory clipboard.
§Errors
Returns an error when neither the system nor in-memory clipboard has text.
Sourcepub fn paste_text(&mut self, text: &str)
pub fn paste_text(&mut self, text: &str)
Insert text at the cursor as one edit — one undo step — replacing
the selection if there is one and re-indenting the pasted block to the
cursor’s level (see Code::smart_paste).
Shared by the Paste action, which pastes the
clipboard, and the host’s bracketed-paste handler, which pastes the text
the terminal hands over. Going through one path is what keeps a terminal
paste undoable in a single step: replayed as individual key events it
would leave one undo entry per character.
Sourcepub fn set_marks(&mut self, marks: Vec<(usize, usize, &str)>)
pub fn set_marks(&mut self, marks: Vec<(usize, usize, &str)>)
Set the highlight marks as (start char, end char, hex color) ranges.
Sourcepub fn marks(&self) -> Option<&Vec<(usize, usize, Color)>>
pub fn marks(&self) -> Option<&Vec<(usize, usize, Color)>>
The current highlight marks (search matches and similar), as
(start char, end char, color) ranges, if any.
Sourcepub fn remove_marks(&mut self)
pub fn remove_marks(&mut self)
Clear all highlight marks.
Sourcepub fn set_fold_ranges(&mut self, ranges: Vec<(usize, usize)>)
pub fn set_fold_ranges(&mut self, ranges: Vec<(usize, usize)>)
Record the foldable line ranges reported by the language server. Drops any active fold whose range is no longer offered.
Sourcepub fn toggle_fold(&mut self, line: usize) -> bool
pub fn toggle_fold(&mut self, line: usize) -> bool
Toggle the fold whose start is line: unfold it if folded, else fold it
if a foldable range starts there. Returns true if anything changed.
Sourcepub fn toggle_manual_fold(&mut self, start: usize, end: usize) -> bool
pub fn toggle_manual_fold(&mut self, start: usize, end: usize) -> bool
Toggle a fold over the explicit inclusive (start, end) line range,
without a language server having reported it — used for Org drawer
folding, where the range is computed on the fly. Folds the range if it is
open, unfolds it if already folded, keeping the caret out of the hidden
region. Returns true if the fold state changed (always, unless the
range is empty). The folded start line renders the ▸ marker and a
trailing ..., matching code folding.
Whether line is hidden inside a currently-folded range
(start < line <= end).
Sourcepub fn unfold_all(&mut self)
pub fn unfold_all(&mut self)
Unfold every active fold.
Sourcepub fn set_inlay_hints(&mut self, hints: Vec<(usize, usize, String)>)
pub fn set_inlay_hints(&mut self, hints: Vec<(usize, usize, String)>)
Set the inline hints to display: (line, char column within line, label).
Sourcepub fn set_semantic_tokens(&mut self, tokens: Vec<(usize, usize, String)>)
pub fn set_semantic_tokens(&mut self, tokens: Vec<(usize, usize, String)>)
Replace the LSP semantic-token overlay (T123a): (start char, end char, theme capture name) spans, merged into Tree-sitter’s own
highlighting at render time (draw_syntax_layer).
Sourcepub fn has_inlay_hints(&self) -> bool
pub fn has_inlay_hints(&self) -> bool
Whether any inline hints are set.
Sourcepub fn fold_marker(&self, line: usize) -> Option<bool>
pub fn fold_marker(&self, line: usize) -> Option<bool>
The fold marker for line: Some(true) if a folded range starts here,
Some(false) if a foldable (but open) range starts here, else None.
Sourcepub fn set_spell_marks(&mut self, marks: Vec<(usize, usize)>)
pub fn set_spell_marks(&mut self, marks: Vec<(usize, usize)>)
Set the spell-check underline marks (char ranges of misspelled words).
Sourcepub fn clear_spell_marks(&mut self)
pub fn clear_spell_marks(&mut self)
Clear all spell-check underline marks.
Sourcepub fn spell_marks(&self) -> Option<&Vec<(usize, usize)>>
pub fn spell_marks(&self) -> Option<&Vec<(usize, usize)>>
The current spell-check underline marks (char ranges), if any.
Sourcepub fn set_word_marks(&mut self, marks: Vec<(usize, usize)>)
pub fn set_word_marks(&mut self, marks: Vec<(usize, usize)>)
Set the passive word-occurrence marks (char ranges); empty clears them.
Sourcepub fn word_marks(&self) -> Option<&Vec<(usize, usize)>>
pub fn word_marks(&self) -> Option<&Vec<(usize, usize)>>
The current word-occurrence marks (char ranges), if any.
Sourcepub fn set_diagnostic_marks(&mut self, marks: Vec<(usize, usize, Color)>)
pub fn set_diagnostic_marks(&mut self, marks: Vec<(usize, usize, Color)>)
Set the LSP diagnostic underline marks: (start char, end char, color).
Sourcepub fn clear_diagnostic_marks(&mut self)
pub fn clear_diagnostic_marks(&mut self)
Clear all LSP diagnostic underline marks.
Sourcepub fn diagnostic_marks(&self) -> Option<&Vec<(usize, usize, Color)>>
pub fn diagnostic_marks(&self) -> Option<&Vec<(usize, usize, Color)>>
The current LSP diagnostic underline marks, if any.
Sourcepub fn set_gutter_marks(&mut self, marks: Vec<(usize, &str)>)
pub fn set_gutter_marks(&mut self, marks: Vec<(usize, &str)>)
Set the git diff gutter marks: (line index, hex color) per changed line.
Sourcepub fn clear_gutter_marks(&mut self)
pub fn clear_gutter_marks(&mut self)
Clear all git diff gutter marks.
Sourcepub fn gutter_marks(&self) -> Option<&Vec<(usize, Color)>>
pub fn gutter_marks(&self) -> Option<&Vec<(usize, Color)>>
The current git diff gutter marks (line index, color), if any.
Sourcepub fn comment_string_ranges(&self) -> Vec<(usize, usize)>
pub fn comment_string_ranges(&self) -> Vec<(usize, usize)>
Char ranges of comment and string tokens in the buffer, for the host’s spell checker to scan. Empty when the language has no Tree-sitter query.
Sourcepub fn char_text(&self, start: usize, end: usize) -> String
pub fn char_text(&self, start: usize, end: usize) -> String
The text of the char range [start, end) as an owned string.
Sourcepub fn word_at(&self, pos: usize) -> Option<(usize, usize, String)>
pub fn word_at(&self, pos: usize) -> Option<(usize, usize, String)>
The word (and its char range) at pos, using the buffer’s word
boundaries; None when pos is not inside a word.
Sourcepub fn get_marks(&self) -> Option<&Vec<(usize, usize, Color)>>
pub fn get_marks(&self) -> Option<&Vec<(usize, usize, Color)>>
Return the highlight marks as (start, end, color) ranges, if any.
Sourcepub fn get_selection_text(&mut self) -> Option<String>
pub fn get_selection_text(&mut self) -> Option<String>
Return the text of the current selection, or None when empty.
Sourcepub fn get_selection(&mut self) -> Option<Selection>
pub fn get_selection(&mut self) -> Option<Selection>
Return the current selection, if any.
Sourcepub fn set_selection(&mut self, selection: Option<Selection>)
pub fn set_selection(&mut self, selection: Option<Selection>)
Set (or clear) the current selection.
Sourcepub fn set_offset_y(&mut self, offset_y: usize)
pub fn set_offset_y(&mut self, offset_y: usize)
Set the vertical scroll offset (first visible line).
Sourcepub fn set_offset_x(&mut self, offset_x: usize)
pub fn set_offset_x(&mut self, offset_x: usize)
Set the horizontal scroll offset (first visible column).
Sourcepub fn get_offset_y(&self) -> usize
pub fn get_offset_y(&self) -> usize
Return the vertical scroll offset (first visible line).
Sourcepub fn get_offset_x(&self) -> usize
pub fn get_offset_x(&self) -> usize
Return the horizontal scroll offset (first visible column).
Sourcepub fn soft_wrap_enabled(&self) -> bool
pub fn soft_wrap_enabled(&self) -> bool
Whether soft wrap is on (no horizontal scrolling when it is).
Sourcepub fn gutter_width(&self) -> usize
pub fn gutter_width(&self) -> usize
Width (columns) of the line-number gutter, so the host can compute the visible text width for a horizontal scrollbar.
Sourcepub fn max_line_width(&self) -> usize
pub fn max_line_width(&self) -> usize
The longest line’s width in characters (used to size a horizontal scrollbar). A tab counts as one character.
Sourcepub fn code_mut(&mut self) -> &mut Code
pub fn code_mut(&mut self) -> &mut Code
Return a mutable reference to the underlying code buffer.
Sourcepub fn top_line(&self) -> usize
pub fn top_line(&self) -> usize
The 0-based index of the first visible line (the vertical scroll offset).
Sourcepub fn poll_parse(&mut self) -> bool
pub fn poll_parse(&mut self) -> bool
Install any completed background reparse (large buffers). Returns true
when the syntax tree was updated, so the host can redraw.
Sourcepub fn parse_pending(&self) -> bool
pub fn parse_pending(&self) -> bool
Whether a background reparse is in flight for this buffer.
Sourcepub fn switch_undo_branch(&mut self) -> bool
pub fn switch_undo_branch(&mut self) -> bool
Cycle which undo-tree branch the next redo will follow. Returns true
when the current state has more than one branch.
Sourcepub fn revision(&self) -> u64
pub fn revision(&self) -> u64
A counter that increases on every content edit, for cheap change detection
(e.g. deciding when to push a didChange to a language server).
Sourcepub fn line_ending(&self) -> &'static str
pub fn line_ending(&self) -> &'static str
The buffer’s line ending: "LF" or "CRLF".
Sourcepub fn selection_span(&self) -> Option<(usize, usize)>
pub fn selection_span(&self) -> Option<(usize, usize)>
The current selection as a sorted (start, end) char range, or None
when there is no (non-empty) selection.
Sourcepub fn set_change_callback(
&mut self,
callback: Box<dyn Fn(Vec<(usize, usize, usize, usize, String)>)>,
)
pub fn set_change_callback( &mut self, callback: Box<dyn Fn(Vec<(usize, usize, usize, usize, String)>)>, )
Set the change callback function for handling document changes
Sourcepub fn highlight_interval(
&self,
start: usize,
end: usize,
theme: &HashMap<String, Style>,
) -> Vec<(usize, usize, Style)>
pub fn highlight_interval( &self, start: usize, end: usize, theme: &HashMap<String, Style>, ) -> Vec<(usize, usize, Style)>
Return cached syntax highlights for the char range [start, end).
Sourcepub fn reset_highlight_cache(&self)
pub fn reset_highlight_cache(&self)
Clear the cached syntax highlights so they are recomputed on next render.
Sourcepub fn get_visible_cursor(&self, area: &Rect) -> Option<(u16, u16)>
pub fn get_visible_cursor(&self, area: &Rect) -> Option<(u16, u16)>
Compute the cursor’s visible (x, y) cell within area, or None when
the cursor is scrolled out of view.
Sourcepub fn show_line_numbers(&mut self, show: bool)
pub fn show_line_numbers(&mut self, show: bool)
Show or hide the line-number gutter.
Sourcepub fn toggle_line_numbers(&mut self) -> bool
pub fn toggle_line_numbers(&mut self) -> bool
Toggle the line-number gutter; returns the new visibility.
Sourcepub fn show_whitespace(&mut self, show: bool)
pub fn show_whitespace(&mut self, show: bool)
Show or hide visible-whitespace glyphs (space, tab, line ending).
Sourcepub fn set_auto_pair(&mut self, on: bool)
pub fn set_auto_pair(&mut self, on: bool)
Enable or disable bracket/quote auto-pairing.
Sourcepub fn set_rainbow_brackets(&mut self, on: bool)
pub fn set_rainbow_brackets(&mut self, on: bool)
Enable or disable rainbow (depth-colored) brackets.
Sourcepub fn set_eol_note(&mut self, note: Option<(usize, String)>)
pub fn set_eol_note(&mut self, note: Option<(usize, String)>)
Set (or clear with None) the end-of-line virtual note: (line, text)
drawn dimmed after that line’s content. Used for inline git blame.
Sourcepub fn set_breakpoints(&mut self, lines: Vec<usize>)
pub fn set_breakpoints(&mut self, lines: Vec<usize>)
Set the debugger breakpoint lines (0-based) drawn in the gutter.
Sourcepub fn set_debug_line(&mut self, line: Option<usize>)
pub fn set_debug_line(&mut self, line: Option<usize>)
Set (or clear) the debugger’s currently-stopped line (0-based).
Sourcepub fn set_soft_wrap(&mut self, on: bool)
pub fn set_soft_wrap(&mut self, on: bool)
Enable or disable soft wrap (long lines wrap instead of scrolling).
Sourcepub fn toggle_soft_wrap(&mut self) -> bool
pub fn toggle_soft_wrap(&mut self) -> bool
Toggle soft wrap; returns the new state.
Sourcepub fn set_indent(&mut self, indent: Option<String>)
pub fn set_indent(&mut self, indent: Option<String>)
Set the indent string inserted by Tab / the Indent action (spaces or a
tab). None restores the per-language default.
Sourcepub fn toggle_whitespace(&mut self) -> bool
pub fn toggle_whitespace(&mut self) -> bool
Toggle visible-whitespace glyphs; returns the new visibility.
Sourcepub fn set_whitespace_style(&mut self, style: Style)
pub fn set_whitespace_style(&mut self, style: Style)
Set the style used for visible-whitespace glyphs (typically dimmed).
Sourcepub fn set_bracket_style(&mut self, style: Style)
pub fn set_bracket_style(&mut self, style: Style)
Set the style used to highlight the bracket matching the one at the cursor.
Sourcepub fn set_left_code_padding(&mut self, char_count: usize)
pub fn set_left_code_padding(&mut self, char_count: usize)
Set the left padding (in characters) between the gutter and the code.
Source§impl Editor
impl Editor
Sourcepub fn input(&mut self, key: KeyEvent, area: &Rect) -> Result<(), Error>
pub fn input(&mut self, key: KeyEvent, area: &Rect) -> Result<(), Error>
Handle a crossterm key event, then scroll to keep the cursor visible.
§Errors
Returns an error when an applied action fails.
Sourcepub fn mouse(&mut self, mouse: MouseEvent, area: &Rect) -> Result<(), Error>
pub fn mouse(&mut self, mouse: MouseEvent, area: &Rect) -> Result<(), Error>
Handle a crossterm mouse event (scroll, click, drag, selection).
§Errors
Returns an error when an applied action fails.
Sourcepub fn autoscroll_tick(&mut self, area: &Rect) -> bool
pub fn autoscroll_tick(&mut self, area: &Rect) -> bool
Repeat the last drag while the pointer is held still outside the top or bottom edge (T581). Call periodically; a no-op when no drag is in progress or the pointer is inside the view. Returns whether it acted.
Source§impl Editor
impl Editor
Sourcepub fn has_multi_carets(&self) -> bool
pub fn has_multi_carets(&self) -> bool
Whether more than one caret is active.
Sourcepub fn clear_carets(&mut self)
pub fn clear_carets(&mut self)
Drop all extra carets, keeping just the primary cursor.
Sourcepub fn caret_selections(&self) -> Vec<(usize, usize)>
pub fn caret_selections(&self) -> Vec<(usize, usize)>
Selection ranges for every caret (primary + extras), for rendering.
Sourcepub fn caret_positions(&self) -> Vec<usize>
pub fn caret_positions(&self) -> Vec<usize>
Cursor offsets for every caret (primary + extras), for rendering.
Sourcepub fn multi_insert(&mut self, text: &str)
pub fn multi_insert(&mut self, text: &str)
Insert text at every caret (replacing each selection), as one undo step.
Carets are processed in ascending order with a running offset shift, so
each edit’s coordinates stay valid in the live buffer.
§Panics
Never in practice: the running shift only ever reflects text‘s
length and prior carets’ removed spans, both bounded by the buffer
this same call is editing, so the isize conversion cannot overflow.
Sourcepub fn multi_delete(&mut self, forward: bool)
pub fn multi_delete(&mut self, forward: bool)
Delete at every caret (each selection, else one char), as one undo step.
§Panics
Never in practice: same bound as Self::multi_insert — the running
shift only ever reflects removed spans within the buffer this same
call is editing, so the isize conversion cannot overflow.
Sourcepub fn multi_move(&mut self, dir: CaretMove, shift: bool)
pub fn multi_move(&mut self, dir: CaretMove, shift: bool)
Move every caret in dir (extending its selection when shift).
Sourcepub fn add_next_occurrence(&mut self)
pub fn add_next_occurrence(&mut self)
Ctrl+D: select the next occurrence of the current selection (or the word
at the cursor) and add it as a new caret, which becomes primary.
Sourcepub fn add_all_occurrences(&mut self)
pub fn add_all_occurrences(&mut self)
Select every occurrence of the current selection (or the word at the cursor) in the buffer: replace any existing extra carets with one selected caret per match, the last of which becomes primary. No-op when there is only a single match.
Sourcepub fn add_caret_at(&mut self, pos: usize)
pub fn add_caret_at(&mut self, pos: usize)
Alt+click: add an extra caret at character offset pos.
Sourcepub fn add_caret_above(&mut self)
pub fn add_caret_above(&mut self)
Add a caret on the line above the main cursor, at the same column (clamped to that line’s length). No-op on the first line.
Sourcepub fn add_caret_below(&mut self)
pub fn add_caret_below(&mut self)
Add a caret on the line below the main cursor, at the same column (clamped to that line’s length). No-op on the last line.
Sourcepub fn column_select(&mut self, down: bool)
pub fn column_select(&mut self, down: bool)
Extend a column (rectangular) selection by one line: add a caret on the
line past the current block frontier, spanning the same columns as the
primary caret’s selection (or a bare caret when there is no selection).
Columns clamp to each line’s length. No-op at the buffer’s top/bottom.
The resulting carets edit together via Editor::multi_insert etc.
Source§impl Editor
impl Editor
Sourcepub fn cursor_down(&mut self)
pub fn cursor_down(&mut self)
Move the cursor down one line.
Sourcepub fn cursor_left(&mut self)
pub fn cursor_left(&mut self)
Move the cursor one character to the left.
Sourcepub fn cursor_right(&mut self)
pub fn cursor_right(&mut self)
Move the cursor one character to the right.
Sourcepub fn select_down(&mut self)
pub fn select_down(&mut self)
Extend the selection one line down.
Sourcepub fn select_left(&mut self)
pub fn select_left(&mut self)
Extend the selection one character to the left.
Sourcepub fn select_right(&mut self)
pub fn select_right(&mut self)
Extend the selection one character to the right.
Sourcepub fn cursor_start(&mut self)
pub fn cursor_start(&mut self)
Move the cursor to the very start of the buffer.
Sourcepub fn cursor_end(&mut self)
pub fn cursor_end(&mut self)
Move the cursor to the very end of the buffer.
Sourcepub fn select_to_start(&mut self)
pub fn select_to_start(&mut self)
Extend the selection to the start of the buffer.
Sourcepub fn select_to_end(&mut self)
pub fn select_to_end(&mut self)
Extend the selection to the end of the buffer.
Sourcepub fn start_of_line(&mut self)
pub fn start_of_line(&mut self)
Move the cursor to the start of the current line.
Sourcepub fn end_of_line(&mut self)
pub fn end_of_line(&mut self)
Move the cursor to the end of the current line.
Sourcepub fn start_of_text(&mut self)
pub fn start_of_text(&mut self)
Move to the first non-whitespace character of the line.
Sourcepub fn start_of_text_toggle(&mut self)
pub fn start_of_text_toggle(&mut self)
Toggle between the first non-whitespace character and column 0.
Sourcepub fn select_to_start_of_line(&mut self)
pub fn select_to_start_of_line(&mut self)
Extend the selection to the start of the current line.
Sourcepub fn select_to_end_of_line(&mut self)
pub fn select_to_end_of_line(&mut self)
Extend the selection to the end of the current line.
Sourcepub fn select_to_start_of_text(&mut self)
pub fn select_to_start_of_text(&mut self)
Extend the selection to the first non-whitespace character of the line.
Sourcepub fn select_to_start_of_text_toggle(&mut self)
pub fn select_to_start_of_text_toggle(&mut self)
Extend the selection, toggling between the first non-whitespace character and column 0.
Sourcepub fn select_line(&mut self)
pub fn select_line(&mut self)
Select the whole current line (including its trailing newline if any).
Sourcepub fn word_right(&mut self)
pub fn word_right(&mut self)
Move the cursor to the start of the next word.
Sourcepub fn sub_word_right(&mut self)
pub fn sub_word_right(&mut self)
Move the cursor right by one sub-word (approximated as a whole word).
Sourcepub fn sub_word_left(&mut self)
pub fn sub_word_left(&mut self)
Move the cursor left by one sub-word (approximated as a whole word).
Sourcepub fn select_word_right(&mut self)
pub fn select_word_right(&mut self)
Extend the selection to the start of the next word.
Sourcepub fn select_word_left(&mut self)
pub fn select_word_left(&mut self)
Extend the selection to the start of the previous word.
Sourcepub fn select_sub_word_right(&mut self)
pub fn select_sub_word_right(&mut self)
Extend the selection right by one sub-word (approximated as a whole word).
Sourcepub fn select_sub_word_left(&mut self)
pub fn select_sub_word_left(&mut self)
Extend the selection left by one sub-word (approximated as a whole word).
Sourcepub fn delete_word_right(&mut self)
pub fn delete_word_right(&mut self)
Delete from the cursor to the start of the next word.
Sourcepub fn delete_word_left(&mut self)
pub fn delete_word_left(&mut self)
Delete from the cursor back to the start of the previous word.
Sourcepub fn delete_sub_word_right(&mut self)
pub fn delete_sub_word_right(&mut self)
Delete the next sub-word (approximated as a whole word).
Sourcepub fn delete_sub_word_left(&mut self)
pub fn delete_sub_word_left(&mut self)
Delete the previous sub-word (approximated as a whole word).
Sourcepub fn paragraph_next(&mut self)
pub fn paragraph_next(&mut self)
Move the cursor to the start of the next paragraph.
Sourcepub fn paragraph_previous(&mut self)
pub fn paragraph_previous(&mut self)
Move the cursor to the start of the previous paragraph.
Sourcepub fn select_to_paragraph_next(&mut self)
pub fn select_to_paragraph_next(&mut self)
Extend the selection to the start of the next paragraph.
Sourcepub fn select_to_paragraph_previous(&mut self)
pub fn select_to_paragraph_previous(&mut self)
Extend the selection to the start of the previous paragraph.
Sourcepub fn page_down(&mut self, view_h: usize)
pub fn page_down(&mut self, view_h: usize)
Move the cursor down one page (the viewport height).
Sourcepub fn select_page_up(&mut self, view_h: usize)
pub fn select_page_up(&mut self, view_h: usize)
Extend the selection up one page (the viewport height).
Sourcepub fn select_page_down(&mut self, view_h: usize)
pub fn select_page_down(&mut self, view_h: usize)
Extend the selection down one page (the viewport height).
Sourcepub fn half_page_up(&mut self, view_h: usize)
pub fn half_page_up(&mut self, view_h: usize)
Move the cursor up half a page.
Sourcepub fn half_page_down(&mut self, view_h: usize)
pub fn half_page_down(&mut self, view_h: usize)
Move the cursor down half a page.
Sourcepub fn cursor_to_view_top(&mut self)
pub fn cursor_to_view_top(&mut self)
Move the cursor to the top/center/bottom visible line, keeping its column.
Sourcepub fn cursor_to_view_center(&mut self, view_h: usize)
pub fn cursor_to_view_center(&mut self, view_h: usize)
Move the cursor to the center visible line, keeping its column.
Sourcepub fn cursor_to_view_bottom(&mut self, view_h: usize)
pub fn cursor_to_view_bottom(&mut self, view_h: usize)
Move the cursor to the bottom visible line, keeping its column.
Sourcepub fn insert_newline(&mut self)
pub fn insert_newline(&mut self)
Insert a newline at the cursor.
Sourcepub fn insert_tab(&mut self)
pub fn insert_tab(&mut self)
Insert a tab (indent) at the cursor.
Sourcepub fn select_all(&mut self)
pub fn select_all(&mut self)
Select the entire buffer.
Sourcepub fn duplicate_line(&mut self)
pub fn duplicate_line(&mut self)
Duplicate the current line.
Sourcepub fn delete_line(&mut self)
pub fn delete_line(&mut self)
Delete the current line.
Sourcepub fn indent_line(&mut self)
pub fn indent_line(&mut self)
Indent the current line.
Sourcepub fn outdent_line(&mut self)
pub fn outdent_line(&mut self)
Outdent the current line.
Sourcepub fn indent_selection(&mut self)
pub fn indent_selection(&mut self)
Indent the selection.
Sourcepub fn outdent_selection(&mut self)
pub fn outdent_selection(&mut self)
Outdent the selection.
Sourcepub fn copy_line(&mut self)
pub fn copy_line(&mut self)
Copy the current line to the clipboard (without changing the selection).
Sourcepub fn insert_str_action(&mut self, text: &str)
pub fn insert_str_action(&mut self, text: &str)
Insert literal text (used by paste-primary fallbacks/tests).
Source§impl Editor
impl Editor
Sourcepub fn matching_bracket_offset(&self) -> Option<usize>
pub fn matching_bracket_offset(&self) -> Option<usize>
Public accessor for the matching bracket offset, used by the host to jump
the cursor to a bracket’s partner (Ctrl+] / the palette).
Source§impl Editor
impl Editor
Sourcepub fn move_line_up(&mut self)
pub fn move_line_up(&mut self)
Move the cursor’s line up one row, swapping it with the line above. No-op on the first line. Records one undoable edit and keeps the cursor on the moved line.
Sourcepub fn move_line_down(&mut self)
pub fn move_line_down(&mut self)
Move the cursor’s line down one row, swapping it with the line below. No-op on the last line. Records one undoable edit and keeps the cursor on the moved line.
Sourcepub fn join_lines(&mut self)
pub fn join_lines(&mut self)
Join the current line with the next, or — when the selection spans several lines — join all of them into one. Adjacent lines are merged with a single space, trimming the trailing space of each line and the leading space of the next. Records one undoable edit. No-op when there is nothing to join (a single line with no line below it).
Sourcepub fn sort_lines(&mut self)
pub fn sort_lines(&mut self)
Sort the selected lines ascending (byte order), or the whole buffer when nothing is selected. Records one undoable edit. No-op on fewer than two lines in range.
Sourcepub fn trim_trailing_whitespace(&mut self)
pub fn trim_trailing_whitespace(&mut self)
Strip trailing whitespace from each line in range (selection, or the whole buffer when nothing is selected).
Sourcepub fn remove_duplicate_lines(&mut self)
pub fn remove_duplicate_lines(&mut self)
Remove duplicate lines in range, keeping the first occurrence of each.
Sourcepub fn reverse_lines(&mut self)
pub fn reverse_lines(&mut self)
Reverse the order of the lines in range.
Sourcepub fn shuffle_lines(&mut self)
pub fn shuffle_lines(&mut self)
Randomly reorder the lines in range (Fisher–Yates, seeded from the OS).
Sourcepub fn sort_unique(&mut self)
pub fn sort_unique(&mut self)
Sort the lines in range ascending and drop duplicates.
Trait Implementations§
Source§impl Widget for &Editor
Draws the main editor view in the provided area using the ratatui rendering buffer.
impl Widget for &Editor
Draws the main editor view in the provided area using the ratatui rendering buffer.
Renders the main editor view in four distinct layers:
- Line numbers and text content are drawn in the visible viewport.
- Syntax highlighting is overlaid on top of the text.
- The selection highlight is rendered above the syntax layer.
- User marks are rendered as the final uppermost overlay.
§Arguments
self- TheEditorinstance (as reference) to render.area- The rectangular area on the terminal to draw within.buf- The ratatuiBufferthat represents the screen cells to draw to.
Auto Trait Implementations§
impl !Freeze for Editor
impl !RefUnwindSafe for Editor
impl !Send for Editor
impl !Sync for Editor
impl !UnwindSafe for Editor
impl Unpin for Editor
impl UnsafeUnpin for Editor
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
replaced by palette::chromatic_adaptation::AdaptIntoUnclamped
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
replaced by palette::chromatic_adaptation::AdaptIntoUnclamped
Source§impl<T, C> AdaptIntoUnclamped<T> for Cwhere
T: AdaptFromUnclamped<C>,
impl<T, C> AdaptIntoUnclamped<T> for Cwhere
T: AdaptFromUnclamped<C>,
Source§type Scalar = <T as AdaptFromUnclamped<C>>::Scalar
type Scalar = <T as AdaptFromUnclamped<C>>::Scalar
Source§fn adapt_into_unclamped_with<M>(self) -> Twhere
M: LmsToXyz<<C as AdaptIntoUnclamped<T>>::Scalar> + XyzToLms<<C as AdaptIntoUnclamped<T>>::Scalar>,
fn adapt_into_unclamped_with<M>(self) -> Twhere
M: LmsToXyz<<C as AdaptIntoUnclamped<T>>::Scalar> + XyzToLms<<C as AdaptIntoUnclamped<T>>::Scalar>,
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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
Source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<T, C> ComponentsInto<C> for T
impl<T, C> ComponentsInto<C> for T
Source§fn components_into(self) -> C
fn components_into(self) -> C
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
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> ⓘ
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> ⓘ
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 moreSource§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more