Enum add_ed::error::EdError

source ·
pub enum EdError {
Show 35 variants Internal(InternalError), IO(IOError), UI(UIError), InfiniteRecursion, IndexTooBig { index: usize, buffer_len: usize, }, Line0Invalid, SelectionEmpty((usize, usize)), SelectionForbidden, UnsavedChanges, NoOp, UndoIndexNegative { relative_undo_limit: usize, }, UndoIndexTooBig { index: usize, history_len: usize, relative_redo_limit: usize, }, CommandEscapeForbidden(String), TagInvalid(String), TagNoMatch(char), RegexInvalid { regex: String, error: Error, }, RegexNoMatch(String), PrintAfterWipe, DefaultFileUnset, DefaultShellCommandUnset, DefaultSArgsUnset, IndexSpecialAfterStart { prior_index: String, special_index: char, }, IndexNotInt(String), OffsetNotInt(String), IndicesUnrelated { prior_index: String, unrelated_index: String, }, IndexUnfinished(String), CommandUndefined(char), ArgumentListEscapedEnd(String), ArgumentsWrongNr { expected: Cow<'static, str>, received: usize, }, ScrollNotInt(String), UndoStepsNotInt(String), ReflowNotInt { error: String, text: String, }, MacroUndefined(String), FlagDuplicate(char), FlagUndefined(char),
}
Expand description

A basic enum Error implementation

Whilst it does implement PartialEq, partial is key in that. Since UI and IO errors aren’t sure to be comparable they are assumed to be equal, so library users can easily identify UI resp. IO errors and downcast them for the proper comparison for the abstracted type.

Variants§

§

Internal(InternalError)

Internal error, usually from something OS related.

§

IO(IOError)

A holder for errors from the IO implementation.

WARNING: internal equality of the held IO error will not be checked. You will need to downcast and verify this yourself if relevant. (See helper on IOError.)

§

UI(UIError)

A holder for errors from the UI implementation.

WARNING: internal equality of the held UI error will not be checked. You will need to downcast and verify this yourself if relevant. (See helper on UIError.)

§

InfiniteRecursion

Execution recursed more times than [Ed.recursion_limit], indicating infinite recursion.

Contains no details until someone writes stack unwinding for it.

§

IndexTooBig

Fields

§index: usize
§buffer_len: usize

Given index exceeds size of buffer.

(Always given if buffer is empty)

§

Line0Invalid

Index 0 isn’t a valid line.

§

SelectionEmpty((usize, usize))

Selection empty or inverted. Holds the interpreted bad selection.

§

SelectionForbidden

Given command doesn’t allow any selection and one was given.

§

UnsavedChanges

Unsaved changes when about to non-forcibly drop/delete buffer.

§

NoOp

Selection and arguments were given that makes its command do nothing.

§

UndoIndexNegative

Fields

§relative_undo_limit: usize

Tried to undo beyond start of history.

§

UndoIndexTooBig

Fields

§index: usize
§history_len: usize
§relative_redo_limit: usize

Tried to redo past end of history.

§

CommandEscapeForbidden(String)

Tried to given shell escape where a file path is required. Holds given path string.

§

TagInvalid(String)

k or K command received an invalid character to tag with. Holds given argument string.

§

TagNoMatch(char)

Given tag found no match. Holds the used tag.

§

RegexInvalid

Fields

§regex: String
§error: Error

Any regex operation received an invalid regex or substitution.

§

RegexNoMatch(String)

Given regex found no match. Holds the used regex.

§

PrintAfterWipe

Flags asked to print after the whole buffer was deleted.

§

DefaultFileUnset

Tried to get default shell command, but it isn’t yet set

§

DefaultShellCommandUnset

Tried to get default shell command, but it isn’t yet set

§

DefaultSArgsUnset

Tried to get default s arguments, but it isn’t yet set

§

IndexSpecialAfterStart

Fields

§prior_index: String
§special_index: char

Special index character found after start of index.

§

IndexNotInt(String)

Given index couldn’t be parsed as a number. Holds its text.

§

OffsetNotInt(String)

Offset part of index couldn’t be parsed as a number. Holds its text.

§

IndicesUnrelated

Fields

§prior_index: String
§unrelated_index: String

Multiple indices with unclear relation (for example 'x2)

§

IndexUnfinished(String)

Unfinished index, a special index without its arguments. Holds its text.

§

CommandUndefined(char)

The given command doesn’t exist. Holds given command char.

§

ArgumentListEscapedEnd(String)

Argument list ended with \. Holds whole argument list.

§

ArgumentsWrongNr

Fields

§expected: Cow<'static, str>
§received: usize

Wrong number of argument.

§

ScrollNotInt(String)

z command received a non numeric number of lines to scroll. Holds given argument.

§

UndoStepsNotInt(String)

u or U command couldn’t interpret nr of steps to undo/redo as integer. Holds given argument.

§

ReflowNotInt

Fields

§error: String
§text: String

J command received a non numeric number of columns to reflow within. Holds given argument.

§

MacroUndefined(String)

The macro invoked wasn’t found. Holds given macro name.

§

FlagDuplicate(char)

Same flag appears more than once. Holds duplicated flag.

§

FlagUndefined(char)

Unexpected flag was received. Holds undefined flag.

Implementations§

source§

impl EdError

source

pub fn regex_error<S: Into<String>>(error: Error, regex: S) -> Self

Trait Implementations§

source§

impl Clone for EdError

source§

fn clone(&self) -> EdError

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 EdError

source§

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

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

impl Display for EdError

source§

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

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

impl Error for EdError

1.30.0 · source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0 · source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl From<IOError> for EdError

source§

fn from(e: IOError) -> Self

Converts to this type from the input type.
source§

impl From<InternalError> for EdError

source§

fn from(e: InternalError) -> Self

Converts to this type from the input type.
source§

impl From<UIError> for EdError

source§

fn from(e: UIError) -> Self

Converts to this type from the input type.
source§

impl PartialEq for EdError

source§

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

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

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl !RefUnwindSafe for EdError

§

impl !Send for EdError

§

impl !Sync for EdError

§

impl Unpin for EdError

§

impl !UnwindSafe for EdError

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> AsAny for T
where T: Any,

source§

fn as_any(&self) -> &(dyn Any + 'static)

source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

source§

fn type_name(&self) -> &'static str

Gets the type name of self
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> Downcast for T
where T: AsAny + ?Sized,

source§

fn is<T>(&self) -> bool
where T: AsAny,

Returns true if the boxed type is the same as T. Read more
source§

fn downcast_ref<T>(&self) -> Option<&T>
where T: AsAny,

Forward to the method defined on the type Any.
source§

fn downcast_mut<T>(&mut self) -> Option<&mut T>
where T: AsAny,

Forward to the method defined on the type Any.
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,

§

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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.