pub enum EditError {
NotFound {
old: String,
},
NotUnique {
old: String,
count: usize,
},
NoOp,
EmptyTarget,
NoEdits,
AnchorOutOfRange {
start: usize,
end: usize,
lines: usize,
},
AnchorShifted,
}Expand description
Why a reconstruction could not be produced. Each variant is a deny at the gate; none of them may be absorbed into a plausible-looking string.
Variants§
NotFound
The target does not occur in the content the edit was applied to. With
MultiEdit this includes a target a PREVIOUS edit destroyed.
NotUnique
The target occurs more than once and replace_all was not set, so the
tool cannot know which was meant. Replacing the first is the plausible
guess and precisely the guess that fabricates a file.
NoOp
old and new are identical — a caller mistake, not a no-op to absorb.
EmptyTarget
An empty target has no meaningful occurrence count; every position matches.
NoEdits
A mutation naming no edits is malformed, not a no-op.
AnchorOutOfRange
The anchor names lines the file does not have, or an inverted range. The family is describing a file we are not looking at.
AnchorShifted
An anchored edit follows one that changed the file’s line count, so its coordinates are ambiguous between two readings the capture does not distinguish: original-file numbering, or numbering in the file as the previous edits left it. Both agree until a line is added or removed, and then they disagree silently. Refusing is the only honest answer until a capture settles it.
Trait Implementations§
impl Eq for EditError
Source§impl Error for EditError
impl Error for EditError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()