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
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
Tried to undo beyond start of history.
UndoIndexTooBig
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
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
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.
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
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
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.