Skip to main content

ExEffect

Enum ExEffect 

Source
pub enum ExEffect {
Show 16 variants None, Save, SaveAs(String), Quit { force: bool, save: bool, }, Unknown(String), Substituted { count: usize, lines_changed: usize, }, Ok, Info(String), InfoTitled { title: &'static str, content: String, }, Error(String), EditFile { path: String, force: bool, }, BufferDelete { force: bool, wipe: bool, }, PutRegister { reg: char, above: bool, }, SaveAndRename { path: String, }, RenameBuffer { name: String, }, Cwd(String),
}
Expand description

Describes what the caller should do after an ex command runs.

Variants that mutate editor state (substitute, goto-line, clear-highlight) are applied in-place inside the dispatcher; everything else is returned so the host loop can act on it.

Variants§

§

None

Nothing happened (empty input or no-op effect).

§

Save

Save the current buffer to the current filename.

§

SaveAs(String)

Save to a specific path (:w <path>). The caller updates its filename field so future :w writes there.

§

Quit

Quit (:q, :q!, :wq, :x).

Fields

§force: bool
§save: bool
§

Unknown(String)

Unknown command — caller should surface as an error toast.

§

Substituted

Substitution finished — report replacement count and lines changed.

Fields

§count: usize
§lines_changed: usize
§

Ok

A no-op response for successful commands that don’t need a side effect but should not be reported as unknown (e.g. :noh).

§

Info(String)

Surface an informational message (single-line or unclassified multi-line).

§

InfoTitled

Surface a titled multi-line listing (:reg, :marks, :jumps, :changes).

The title is a static label used by the host to open a named info popup without brittle header-prefix string matching.

Fields

§title: &'static str

Short human-readable label for the popup window (e.g. "registers").

§content: String

Full body text, newline-separated.

§

Error(String)

Surface an error message (syntax error, bad pattern, …).

§

EditFile

:e <path> / :edit <path> — open a different file in the current window. An empty path means reload the current buffer.

Fields

§path: String
§force: bool
§

BufferDelete

:bd[!] / :bw[!] — close the current buffer. wipe = true for :bwipeout; force = true when ! was given.

Fields

§force: bool
§wipe: bool
§

PutRegister

:put [{reg}] / :pu [{reg}] — paste register contents as a new line below (or above when above = true) the cursor.

Fields

§reg: char
§above: bool
§

SaveAndRename

:saveas {path} / :sav {path} — write buffer to path AND rename the buffer identity so future :w writes there. Distinct from SaveAs (:w <path>) which writes elsewhere but keeps the buffer’s own filename unchanged.

Fields

§path: String
§

RenameBuffer

:file {name} — rename the current buffer in-memory without writing.

Fields

§name: String
§

Cwd(String)

:cd [{path}] — change the working directory. An empty path means $HOME. The directory change is applied inside the handler; the new path is surfaced so the host can update its status-line / title.

Trait Implementations§

Source§

impl Clone for ExEffect

Source§

fn clone(&self) -> ExEffect

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ExEffect

Source§

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

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

impl PartialEq for ExEffect

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 ExEffect

Source§

impl StructuralPartialEq for ExEffect

Auto Trait Implementations§

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, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more