#[non_exhaustive]pub struct EditResult {Show 14 fields
pub path: String,
pub original_content: String,
pub new_content: String,
pub diff: String,
pub applied: bool,
pub changed: bool,
pub action: &'static str,
pub dest_path: Option<String>,
pub match_count: usize,
pub removed: usize,
pub match_mode: Option<MatchMode>,
pub match_score: Option<f64>,
pub matched_text: Option<String>,
pub backup_session: Option<String>,
}Expand description
The result of an editing operation.
Marked non_exhaustive so new honesty fields (for example matched_text)
can land in minor releases without breaking external struct literals.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.path: StringPath to the affected file (as provided by the caller).
original_content: StringThe original file content before the edit.
new_content: StringThe new content after the edit.
diff: StringA unified diff between original and new content.
applied: boolWhether the file was actually written to disk.
changed: boolWhether the content changed.
action: &'static strAction/kind of the edit (e.g. “append”, “create”, “replace”, “rename”, “doc.set”). Helps agent hosts distinguish cross-file or op type without parsing path.
dest_path: Option<String>For cross-file operations (e.g. file_rename, md_move_section with to),
the destination path if different from path.
match_count: usizeNumber of times the search pattern matched in the original content.
Only meaningful for replace operations; defaults to 0 for other
operation types (doc, md, file, patch, tidy).
removed: usizeNumber of items removed by the operation (keys, array elements, etc.).
Meaningful for doc.delete and doc.delete_where (including
idempotent no-ops where removed == 0 and changed == false).
Defaults to 0 for other operation types. Mirrors MCP/tx JSON
mutation summaries so embedders can report delete outcomes without
re-reading the file or parsing diffs (#1459 / #1439).
match_mode: Option<MatchMode>Match strategy used for replace ops (None for non-replace ops). See #1662.
match_score: Option<f64>Similarity score when MatchMode::Fuzzy was used; otherwise None.
matched_text: Option<String>Text actually matched for fuzzy/anchored replace (may differ from old).
Agents must not treat match_mode == Fuzzy + high match_score alone as
“correct target”: compare this field to the requested pattern and prefer
ast_rename for identifier renames (#1736). For over-wide fuzzy spans,
with for_agent, auto-refuse via ReplaceOptions::refuse_suspicious_fuzzy;
custom options still call fuzzy_span_suspicious before trust (#1981 / #2005).
backup_session: Option<String>Backup session timestamp created for this Apply (if any).
Set when a write produced a backup session (see BackupSession::finalize).
None for Preview/Check, no-ops, or when nothing was backed up.
Use with crate::backup::restore_path_from_session for surgical undo (#1686).
Trait Implementations§
Source§impl Clone for EditResult
impl Clone for EditResult
Source§fn clone(&self) -> EditResult
fn clone(&self) -> EditResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for EditResult
impl RefUnwindSafe for EditResult
impl Send for EditResult
impl Sync for EditResult
impl Unpin for EditResult
impl UnsafeUnpin for EditResult
impl UnwindSafe for EditResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more