pub struct BatchEdit {
pub semantic_path: String,
pub edit_type: String,
pub new_code: Option<String>,
pub old_text: Option<String>,
pub context_line: Option<u32>,
pub replacement_text: Option<String>,
pub normalize_whitespace: bool,
}Expand description
A single edit in a replace_batch call.
Each edit specifies either semantic targeting (Option A) OR text targeting (Option B):
Option A — Semantic targeting: Set semantic_path, edit_type, and optionally new_code.
Use for source-code constructs that have a parseable AST symbol.
Option B — Text targeting: Set old_text, context_line, and optionally replacement_text.
Use for Vue <template>/<style> zones or any region with no usable semantic path.
The search scans ±25 lines around context_line for an exact match of old_text.
Fields§
§semantic_path: StringFull semantic path to the target (e.g., file.vue::script::check).
Required when using semantic targeting.
edit_type: StringEdit type: replace_body, replace_full, insert_before, insert_after, or delete.
Required when using semantic targeting.
new_code: Option<String>Replacement code (required for all semantic types except delete).
old_text: Option<String>Exact text to find and replace. Set this for template/style edits that have no
semantic path (e.g., Vue <template>, <style> zones, embedded SQL).
When set, semantic_path and edit_type are ignored.
The search scans ±25 lines around context_line for an exact match.
context_line: Option<u32>Line number (1-indexed) to anchor the old_text search window.
Required when old_text is set. The search scans ±25 lines around this line.
replacement_text: Option<String>Replacement text when using text targeting. Required when old_text is set.
normalize_whitespace: boolWhen true, collapses \s+ to a single space before matching old_text.
Useful for HTML/template contexts where indentation may be inconsistent.
Do NOT use for Python, YAML, or other whitespace-significant languages.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for BatchEdit
impl<'de> Deserialize<'de> for BatchEdit
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for BatchEdit
impl JsonSchema for BatchEdit
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for BatchEdit
impl RefUnwindSafe for BatchEdit
impl Send for BatchEdit
impl Sync for BatchEdit
impl Unpin for BatchEdit
impl UnsafeUnpin for BatchEdit
impl UnwindSafe for BatchEdit
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> 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