Skip to main content

Editor

Struct Editor 

Source
pub struct Editor {
    pub tabs: Vec<Tab>,
    pub active: usize,
    pub line_numbers: bool,
    pub relative_line_numbers: bool,
    pub show_whitespace: bool,
    pub soft_wrap: bool,
    pub indent: String,
    pub split_root: Option<Pane>,
    pub focused_leaf: usize,
}
Expand description

The tab strip: a stack of open buffers and the active index.

Fields§

§tabs: Vec<Tab>

Open buffers, left to right.

§active: usize

Index of the active tab.

§line_numbers: bool

Whether the line-number gutter is shown.

§relative_line_numbers: bool

Whether line numbers are shown relative to the cursor line.

§show_whitespace: bool

Whether visible-whitespace glyphs are shown.

§soft_wrap: bool

Whether long lines soft-wrap.

§indent: String

String Tab inserts in every buffer (spaces or a tab).

§split_root: Option<Pane>

Split layout (a binary tree of panes), when the editor area is divided. None is the normal single-pane case.

§focused_leaf: usize

In-order index of the focused leaf within split_root (0 when unsplit).

Implementations§

Source§

impl Editor

Source

pub fn new( line_numbers: bool, show_whitespace: bool, soft_wrap: bool, indent: String, ) -> Self

Create an editor with one empty buffer and the given gutter / whitespace / soft-wrap / indentation settings.

Source

pub fn active_tab(&self) -> Option<&Tab>

The active tab, if any.

Source

pub fn active_tab_mut(&mut self) -> Option<&mut Tab>

Mutable access to the active tab, if any.

Source

pub fn is_split(&self) -> bool

Whether the editor area is split into more than one pane.

Source

pub fn set_split(&mut self, dir: SplitDir)

Split the focused pane in dir, showing another tab (the next one, else the active tab) in the new pane. Creates the split on the first call; later calls split the currently focused pane. Capped at MAX_LEAVES panes.

Source

pub fn unsplit(&mut self)

Remove the focused pane, collapsing the split; a single remaining pane returns to the unsplit state.

Source

pub fn focus_leaf(&mut self, i: usize)

Focus the leaf at in-order index i, making its tab active.

Source

pub fn focus_other_pane(&mut self)

Move focus to the next pane (wrapping), making its tab active.

Source

pub fn focused_leaf(&self) -> usize

The in-order index of the focused pane.

Source

pub fn split_layout(&mut self, area: Rect) -> Vec<LeafBox>

Lay out the split panes into area (focused leaf synced to active). Empty when unsplit.

Source

pub fn split_dividers(&self, area: Rect) -> Vec<(SplitDir, Rect)>

The split divider rectangles for drawing, given the editor area.

Source

pub fn focus_pane_at(&mut self, area: Rect, col: u16, row: u16) -> bool

Focus the pane under (col, row) within area; returns whether a pane was hit.

Source

pub fn resize_split_at(&mut self, area: Rect, col: u16, row: u16) -> bool

Drag a split divider under (col, row) within area; returns whether one was resized.

Source

pub fn new_tab(&mut self)

Create an empty untitled buffer and focus it.

Source

pub fn new_tab_with_content(&mut self, content: &str)

Open a new untitled tab pre-filled with content (e.g. AI output), marked dirty so the user is reminded to save it. Becomes the active tab.

Source

pub fn open_image(&mut self, path: &Path, proto: StatefulProtocol)

Open an image file in a tab, rendered with the given protocol.

Source

pub fn refresh_line_numbers(&mut self)

Apply the current line-number settings (visibility + relative) to every buffer.

Source

pub fn refresh_whitespace(&mut self)

Apply the current visible-whitespace setting to every buffer.

Source

pub fn refresh_soft_wrap(&mut self)

Apply the current soft-wrap setting to every buffer.

Source

pub fn refresh_theme(&mut self)

Re-apply the current theme’s styles to every buffer (after a theme switch).

Source

pub fn open(&mut self, path: &Path, preview: bool) -> Result<()>

Open a file: focus it if already open, otherwise load it. preview requests an ephemeral tab that the next preview reuses.

§Errors

Returns an error if the file cannot be read.

Source

pub fn reload_clean_from_disk(&mut self) -> usize

Reload every clean (non-dirty) file-backed buffer from disk, preserving the cursor where it still fits. Used after an external change to the working tree (e.g. a git branch switch). Dirty buffers are left untouched so unsaved edits are never discarded. Returns the number of buffers reloaded.

Source

pub fn promote_active(&mut self)

Promote the active preview tab to a permanent tab.

Source

pub fn save_active(&mut self, opts: SaveOptions) -> Result<PathBuf>

Save the active buffer to its existing path.

§Errors

Returns an error if the buffer has no path, or the write fails.

Source

pub fn save_active_as( &mut self, path: PathBuf, opts: SaveOptions, ) -> Result<PathBuf>

Save the active buffer to path and adopt it as the buffer’s path.

§Errors

Returns an error if the write fails.

Source

pub fn close_active(&mut self) -> Option<PathBuf>

Close the active tab; keeps at least one empty buffer open. Returns the closed tab’s file path, if it had one (for “reopen closed tab”).

Source

pub fn close_all(&mut self) -> Vec<PathBuf>

Close every tab, leaving a single empty untitled buffer. Returns the file paths of the closed tabs, oldest first (for “reopen closed tab”).

Source

pub fn next_tab(&mut self)

Activate the next tab, wrapping around.

Source

pub fn prev_tab(&mut self)

Activate the previous tab, wrapping around.

Source

pub fn cursor_1based(&self) -> (usize, usize)

1-based (line, column) of the active cursor, for the status bar.

Source

pub fn active_line_count(&self) -> usize

Total line count of the active buffer (for the scrollbar).

Source

pub fn goto(&mut self, line: usize, col: Option<usize>, area: Rect)

Jump the active buffer to a 1-based line and optional 1-based column, keeping the target visible within area. The line is clamped to the buffer’s range (an out-of-range line would otherwise panic).

Source

pub fn cursor_line_home(&mut self)

Move the active cursor to the start of its current line. Smart Home: jump to the first non-blank character of the line; if already there (or the line is blank), jump to column 0. Pressing Home repeatedly toggles between the two.

Source

pub fn cursor_document_start(&mut self, area: Rect)

Move the active cursor to the very start of the buffer and scroll it into area.

Source

pub fn cursor_document_end(&mut self, area: Rect)

Move the active cursor to the very end of the buffer (past the last character) and scroll it into area.

Source

pub fn cursor_line_end(&mut self)

Move the active cursor to the end of its current line.

Source

pub fn cursor_line_start(&mut self)

Move the active cursor to column 0 of its current line (the literal line start, unlike the smart-Home cursor_line_home).

Source

pub fn cursor_paragraph_start(&mut self, area: Rect)

Move the active cursor to the first line of the current paragraph and scroll it into area. Paragraphs are delimited by blank (empty or whitespace-only) lines; from a blank line, climbs to the paragraph above.

Source

pub fn cursor_paragraph_end(&mut self, area: Rect)

Move the active cursor to the end of the last line of the current paragraph and scroll it into area. See [cursor_paragraph_start].

Source

pub fn cursor_section_start(&mut self, area: Rect)

Move the active cursor to the first line of the current section and scroll it into area. Sections are delimited by a run of two or more consecutive blank lines (a larger break than a paragraph).

Source

pub fn cursor_section_end(&mut self, area: Rect)

Move the active cursor to the end of the last line of the current section and scroll it into area. See [cursor_section_start].

Source

pub fn cursor_line_down(&mut self, area: Rect)

Move the active cursor down one line (Go → Line → Next).

Source

pub fn cursor_line_up(&mut self, area: Rect)

Move the active cursor up one line (Go → Line → Previous).

Source

pub fn cursor_line(&self) -> usize

0-based line of the active cursor (0 when there is no buffer).

Source

pub fn poll_parse(&mut self) -> bool

Install any completed background reparse for the active buffer (large files). Returns true if the syntax tree changed (request a redraw).

Source

pub fn parse_pending(&self) -> bool

Whether a background reparse is in flight for the active buffer.

Source

pub fn switch_undo_branch(&mut self) -> bool

Cycle which undo-tree branch the next redo follows in the active buffer. Returns true if the current state has more than one branch.

Source

pub fn top_visible_line(&self) -> usize

The 0-based index of the active buffer’s first visible line (vertical scroll offset), or 0 when there is no buffer.

Source

pub fn set_word_marks(&mut self, marks: Vec<(usize, usize)>)

Set the passive word-occurrence marks on the active buffer.

Source

pub fn cursor_paragraph_next(&mut self, area: Rect)

Move to the start of the next paragraph (Go → Paragraph → Next).

Source

pub fn cursor_paragraph_prev(&mut self, area: Rect)

Move to the start of the previous paragraph (Go → Paragraph → Previous).

Source

pub fn goto_paragraph(&mut self, n: usize, area: Rect)

Jump to the 1-based nth paragraph (Go → Paragraph → Number).

Source

pub fn cursor_section_next(&mut self, area: Rect)

Move to the start of the next section (Go → Section → Next).

Source

pub fn cursor_section_prev(&mut self, area: Rect)

Move to the start of the previous section (Go → Section → Previous).

Source

pub fn goto_section(&mut self, n: usize, area: Rect)

Jump to the 1-based nth section (Go → Section → Number).

Source

pub fn goto_offset(&mut self, off: usize, area: Rect)

Move the active cursor to char offset off and scroll it into view. Move the active cursor to char offset off and scroll it into view.

Source

pub fn cursor_sentence_start(&mut self, area: Rect)

Move to the start of the current sentence (Go → Sentence → Start).

Source

pub fn cursor_sentence_end(&mut self, area: Rect)

Move to the end of the current sentence — its last non-blank char (Go → Sentence → End).

Source

pub fn cursor_sentence_next(&mut self, area: Rect)

Move to the start of the next sentence (Go → Sentence → Next).

Source

pub fn cursor_sentence_prev(&mut self, area: Rect)

Move to the start of the previous sentence (Go → Sentence → Previous).

Source

pub fn goto_sentence(&mut self, n: usize, area: Rect)

Jump to the 1-based nth sentence (Go → Sentence → Number).

Source

pub fn cursor_word_start(&mut self, area: Rect)

Move to the start of the current word — or the previous word’s start if the cursor is not on a word (Go → Word → Start).

Source

pub fn cursor_word_end(&mut self, area: Rect)

Move to the end of the current word (Go → Word → End).

Source

pub fn cursor_word_next(&mut self, area: Rect)

Move to the start of the next word (Go → Word → Next).

Source

pub fn cursor_word_prev(&mut self, area: Rect)

Move to the start of the previous word (Go → Word → Previous).

Source

pub fn goto_word(&mut self, n: usize, area: Rect)

Jump to the 1-based nth word (Go → Word → Number).

Source

pub fn goto_percent(&mut self, pct: usize, area: Rect)

Jump to pct% through the file (by line), clamped to 0..=100.

Source

pub fn goto_byte(&mut self, byte: usize, area: Rect)

Jump to the character at byte offset byte (clamped to the buffer end).

Source

pub fn select_line(&mut self, area: Rect)

Select the current line, including its trailing newline (so it can be cut as a whole line), and scroll it into area.

Source

pub fn select_paragraph(&mut self, area: Rect)

Select the whole paragraph under the cursor (blank-line delimited) and scroll it into area.

Source

pub fn select_section(&mut self, area: Rect)

Select the whole section under the cursor (delimited by runs of two or more blank lines) and scroll it into area.

Source

pub fn insert_str(&mut self, text: &str, area: Rect) -> bool

Insert text at the active buffer’s cursor and scroll it into area. Returns whether the text was inserted (false when there is no editable buffer, e.g. an image tab). Marks the buffer dirty and promotes a preview.

Source

pub fn select_all(&mut self)

Select the entire active buffer.

Source

pub fn duplicate_line(&mut self)

Duplicate the cursor line (or the selection) in the active buffer.

Source

pub fn join_lines(&mut self)

Join the active buffer’s current line with the next (or all selected lines into one).

Source

pub fn sort_lines(&mut self)

Sort the active buffer’s selected lines ascending, or the whole buffer when nothing is selected.

Source

pub fn trim_trailing_whitespace(&mut self)

Strip trailing whitespace from the selected lines (or the whole buffer).

Source

pub fn remove_duplicate_lines(&mut self)

Remove duplicate lines in the selection (or the whole buffer).

Source

pub fn reverse_lines(&mut self)

Reverse the order of the selected lines (or the whole buffer).

Source

pub fn sort_unique(&mut self)

Sort the selected lines ascending and drop duplicates (or the whole buffer).

Source

pub fn shuffle_lines(&mut self)

Randomly reorder the selected lines (or the whole buffer).

Source

pub fn move_line(&mut self, down: bool, area: Rect)

Move the active buffer’s cursor line up or down by one row, scrolling it into area.

Source

pub fn select_word(&mut self, forward: bool, area: Rect)

Extend the selection by one word: forward grows the active end to the next word boundary on the right (“Select More”), otherwise to the previous word boundary on the left (“Select Less”).

Source

pub fn jump_matching_bracket(&mut self, area: Rect)

Jump the cursor to the partner of the bracket at (or just before) it, scrolling it into area. No-op when the cursor is not on a bracket.

Source

pub fn delete_forward(&mut self)

Forward-delete (the Delete key): step right, then delete back.

Source

pub fn page_up(&mut self, lines: usize)

Move the cursor up by lines (PageUp).

Source

pub fn page_down(&mut self, lines: usize)

Move the cursor down by lines (PageDown).

Trait Implementations§

Source§

impl Default for Editor

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Editor

§

impl !Send for Editor

§

impl !Sync for Editor

§

impl !UnwindSafe for Editor

§

impl Freeze 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 S
where 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) -> D
where M: TransformMatrix<T>,

Convert the source color to the destination color using the specified method.
Source§

fn adapt_into(self) -> D

Convert the source color to the destination color using the bradford method by default.
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T, C> ArraysFrom<C> for T
where C: IntoArrays<T>,

Source§

fn arrays_from(colors: C) -> T

Cast a collection of colors into a collection of arrays.
Source§

impl<T, C> ArraysInto<C> for T
where C: FromArrays<T>,

Source§

fn arrays_into(self) -> C

Cast this collection of arrays into a collection of colors.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for U
where T: FromCam16Unclamped<WpParam, U>,

Source§

type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T, C> ComponentsFrom<C> for T
where C: IntoComponents<T>,

Source§

fn components_from(colors: C) -> T

Cast a collection of colors into a collection of color components.
Source§

impl<T> Conv for T

Source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<T> FmtForward for T

Source§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
Source§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
Source§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
Source§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
Source§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
Source§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
Source§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
Source§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
Source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromAngle<T> for T

Source§

fn from_angle(angle: T) -> T

Performs a conversion from angle.
Source§

impl<T, U> FromStimulus<U> for T
where U: IntoStimulus<T>,

Source§

fn from_stimulus(other: U) -> T

Converts other into Self, while performing the appropriate scaling, rounding and clamping.
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> IntoAngle<U> for T
where U: FromAngle<T>,

Source§

fn into_angle(self) -> U

Performs a conversion into T.
Source§

impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for U
where T: Cam16FromUnclamped<WpParam, U>,

Source§

type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<T, U> IntoColor<U> for T
where U: FromColor<T>,

Source§

fn into_color(self) -> U

Convert into T with values clamped to the color defined bounds Read more
Source§

impl<T, U> IntoColorUnclamped<U> for T
where U: FromColorUnclamped<T>,

Source§

fn into_color_unclamped(self) -> U

Convert into T. The resulting color might be invalid in its color space Read more
Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> IntoStimulus<T> for T

Source§

fn into_stimulus(self) -> T

Converts self into T, while performing the appropriate scaling, rounding and clamping.
Source§

impl<T> Pipe for T
where T: ?Sized,

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
Source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
Source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows 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
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows 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
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
Source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Tap for T

Source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
Source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
Source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
Source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
Source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
Source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
Source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
Source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
Source§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
Source§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .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
where Self: BorrowMut<B>, B: ?Sized,

Calls .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
where Self: AsRef<R>, R: ?Sized,

Calls .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
where Self: AsMut<R>, R: ?Sized,

Calls .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
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T, C> TryComponentsInto<C> for T
where C: TryFromComponents<T>,

Source§

type Error = <C as TryFromComponents<T>>::Error

The error for when try_into_colors fails to cast.
Source§

fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>

Try to cast this collection of color components into a collection of colors. Read more
Source§

impl<T> TryConv for T

Source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, U> TryIntoColor<U> for T
where U: TryFromColor<T>,

Source§

fn try_into_color(self) -> Result<U, OutOfBounds<U>>

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more
Source§

impl<C, U> UintsFrom<C> for U
where C: IntoUints<U>,

Source§

fn uints_from(colors: C) -> U

Cast a collection of colors into a collection of unsigned integers.
Source§

impl<C, U> UintsInto<C> for U
where C: FromUints<U>,

Source§

fn uints_into(self) -> C

Cast this collection of unsigned integers into a collection of colors.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V