Enum rustyline::Cmd

source ·
#[non_exhaustive]
pub enum Cmd {
Show 42 variants Abort, AcceptLine, BeginningOfHistory, CapitalizeWord, ClearScreen, Complete, CompleteBackward, CompleteHint, Dedent(Movement), DowncaseWord, EndOfFile, EndOfHistory, ForwardSearchHistory, HistorySearchBackward, HistorySearchForward, Indent(Movement), Insert(RepeatCount, String), Interrupt, Kill(Movement), Move(Movement), NextHistory, Noop, Overwrite(char), PreviousHistory, QuotedInsert, ReplaceChar(RepeatCount, char), Replace(Movement, Option<String>), ReverseSearchHistory, SelfInsert(RepeatCount, char), Suspend, TransposeChars, TransposeWords(RepeatCount), Undo(RepeatCount), Unknown, UpcaseWord, ViYankTo(Movement), Yank(RepeatCount, Anchor), YankPop, LineUpOrPreviousHistory(RepeatCount), LineDownOrNextHistory(RepeatCount), Newline, AcceptOrInsertLine { accept_in_the_middle: bool, },
}
Expand description

Commands

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Abort

abort

§

AcceptLine

accept-line

See also AcceptOrInsertLine

§

BeginningOfHistory

beginning-of-history

§

CapitalizeWord

capitalize-word

§

ClearScreen

clear-screen

§

Complete

complete

§

CompleteBackward

complete-backward

§

CompleteHint

complete-hint

§

Dedent(Movement)

Dedent current line

§

DowncaseWord

downcase-word

§

EndOfFile

vi-eof-maybe

§

EndOfHistory

end-of-history

§

ForwardSearchHistory

forward-search-history (incremental search)

§

HistorySearchBackward

history-search-backward (common prefix search)

§

HistorySearchForward

history-search-forward (common prefix search)

§

Indent(Movement)

Indent current line

§

Insert(RepeatCount, String)

Insert text

§

Interrupt

Interrupt signal (Ctrl-C)

§

Kill(Movement)

backward-delete-char, backward-kill-line, backward-kill-word delete-char, kill-line, kill-word, unix-line-discard, unix-word-rubout, vi-delete, vi-delete-to, vi-rubout

§

Move(Movement)

backward-char, backward-word, beginning-of-line, end-of-line, forward-char, forward-word, vi-char-search, vi-end-word, vi-next-word, vi-prev-word

§

NextHistory

next-history

§

Noop

No action

§

Overwrite(char)

vi-replace

§

PreviousHistory

previous-history

§

QuotedInsert

quoted-insert

§

ReplaceChar(RepeatCount, char)

vi-change-char

§

Replace(Movement, Option<String>)

vi-change-to, vi-substitute

§

ReverseSearchHistory

reverse-search-history (incremental search)

§

SelfInsert(RepeatCount, char)

self-insert

§

Suspend

Suspend signal (Ctrl-Z on unix platform)

§

TransposeChars

transpose-chars

§

TransposeWords(RepeatCount)

transpose-words

§

Undo(RepeatCount)

undo

§

Unknown

Unsupported / unexpected

§

UpcaseWord

upcase-word

§

ViYankTo(Movement)

vi-yank-to

§

Yank(RepeatCount, Anchor)

yank, vi-put

§

YankPop

yank-pop

§

LineUpOrPreviousHistory(RepeatCount)

moves cursor to the line above or switches to prev history entry if the cursor is already on the first line

§

LineDownOrNextHistory(RepeatCount)

moves cursor to the line below or switches to next history entry if the cursor is already on the last line

§

Newline

Inserts a newline

§

AcceptOrInsertLine

Either accepts or inserts a newline

Always inserts newline if input is non-valid. Can also insert newline if cursor is in the middle of the text

If you support multi-line input:

  • Use accept_in_the_middle: true for mostly single-line cases, for example command-line.
  • Use accept_in_the_middle: false for mostly multi-line cases, for example SQL or JSON input.

Fields

§accept_in_the_middle: bool

Whether this commands accepts input if the cursor not at the end of the current input

Implementations§

source§

impl Cmd

source

pub const fn should_reset_kill_ring(&self) -> bool

Tells if current command should reset kill ring.

Trait Implementations§

source§

impl Clone for Cmd

source§

fn clone(&self) -> Cmd

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Cmd

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Cmd> for EventHandler

source§

fn from(c: Cmd) -> EventHandler

Converts to this type from the input type.
source§

impl PartialEq for Cmd

source§

fn eq(&self, other: &Cmd) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Cmd

source§

impl StructuralPartialEq for Cmd

Auto Trait Implementations§

§

impl Freeze for Cmd

§

impl RefUnwindSafe for Cmd

§

impl Send for Cmd

§

impl Sync for Cmd

§

impl Unpin for Cmd

§

impl UnwindSafe for Cmd

Blanket Implementations§

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> 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<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.