#[non_exhaustive]pub struct ContentEditsResult {
pub original: String,
pub modified: String,
pub diff: String,
pub changed: bool,
pub ops_applied: usize,
pub match_count: usize,
pub match_mode: Option<MatchMode>,
pub match_score: Option<f64>,
pub matched_text: Option<String>,
pub op_honesty: Vec<ContentEditHonesty>,
}Expand description
Result of applying a sequence of ContentEdits to a buffer.
Marked non_exhaustive so new honesty fields 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.original: StringOriginal buffer before any edits.
modified: StringBuffer after all edits (or unchanged when changed is false).
diff: StringUnified diff from original to modified.
changed: boolWhether any edit changed the buffer.
ops_applied: usizeNumber of ops that successfully applied (equals edits.len() on success).
match_count: usizeSum of replace match counts across all ContentEdit::Replace ops.
Insert/append/prepend contribute 0. Useful for agent ambiguity policies.
match_mode: Option<MatchMode>Worst-case match strategy across replace ops (Fuzzy > Anchored > Exact).
None when no replace ops ran or none matched.
match_score: Option<f64>Lowest fuzzy similarity score across replace ops in the batch (worst-case confidence when several fuzzy ops ran).
matched_text: Option<String>Matched span for host policy: widest fuzzy/anchored span in the batch by Unicode char count (worst-case over-wide for refuse; #1736 / #1981). Not the first non-empty only (that hid later over-wide fuzzy ops).
Pairing note: match_score is the minimum fuzzy score across ops;
matched_text is the widest span. They may come from different ops.
Prefer Self::op_honesty with the corresponding old when possible; do not
treat rolled-up fields as a single joint (old, span, score) triple.
op_honesty: Vec<ContentEditHonesty>Per successful replace-like op, in apply order (#2006). Empty when no replace ops reported match honesty.
Trait Implementations§
Source§impl Clone for ContentEditsResult
impl Clone for ContentEditsResult
Source§fn clone(&self) -> ContentEditsResult
fn clone(&self) -> ContentEditsResult
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 ContentEditsResult
impl RefUnwindSafe for ContentEditsResult
impl Send for ContentEditsResult
impl Sync for ContentEditsResult
impl Unpin for ContentEditsResult
impl UnsafeUnpin for ContentEditsResult
impl UnwindSafe for ContentEditsResult
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