pub struct Edit {Show 20 fields
pub file: String,
pub entity: Option<EntityRef>,
pub op: Option<String>,
pub kind: Option<String>,
pub ordinal: Option<usize>,
pub content: Option<String>,
pub old: Option<String>,
pub new: Option<String>,
pub all: bool,
pub after: Option<String>,
pub before: Option<String>,
pub append: bool,
pub into: Option<String>,
pub delete: bool,
pub allow_signature_change: bool,
pub rename: Option<String>,
pub expect: Option<String>,
pub everywhere: bool,
pub scope: Vec<String>,
pub revert: Option<String>,
}Fields§
§file: StringThe file, relative to the repository root.
entity: Option<EntityRef>The entity to change: a function, class, method or key, by name.
Parent.name (or Parent::name) picks a member of one class. Also
takes pi-sem’s form, {name, entity_type?, parent_name?, ordinal?}.
op: Option<String>pi-sem’s verb: replace, insert_after, insert_before or delete,
each about entity. The same edits are also spelled with content,
after, before and delete directly.
kind: Option<String>The entity’s kind (function, method, class…) when names collide.
ordinal: Option<usize>0-based occurrence among entities that still match, in file order.
content: Option<String>The new source. With entity: the entity’s whole new text. With
after, before or append: the entity to add. Alone, for a file that
does not exist: the new file.
old: Option<String>Text to replace, inside entity when one is named, else in the whole
file. Must match exactly once unless all is set.
new: Option<String>What old becomes.
all: boolReplace every occurrence of old, not exactly one.
after: Option<String>Add content as a new entity right after this one.
before: Option<String>Add content as a new entity right before this one.
append: boolAdd content at the end of the file.
into: Option<String>Add content as the last member of this class (or other container),
so a new method needs no anchor and nothing read first.
delete: boolDelete entity.
allow_signature_change: boolLet a replace rename the entity, change its kind or its visibility
(export, pub, public…). Refused otherwise, since that is how an
edit meant for one entity silently becomes a different one.
rename: Option<String>Rename entity (defined in file) to this name, and every identifier
spelled like it in the code files of scope. Strings and comments are
left alone; files without a grammar that mention it are listed.
expect: Option<String>The entity’s version as sem showed it (v:…): the edit is refused if
the entity changed since, so two agents never overwrite each other’s
version of one function.
everywhere: boolFor rename: also rename the name where it appears as a whole word in
comments and in docs and other text files (Markdown, reStructuredText,
plain text). String literals are still left alone.
scope: Vec<String>For rename: the files to rename in, as git pathspec globs
(src/**, *.py). Default: the whole repository.
revert: Option<String>Put entity back the way it was at this git ref (HEAD~3, a branch,
a commit): its text at that ref replaces its text now, and nothing else
in the file moves. A revert is a replace whose content comes from
history, so every replace guard still applies.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Edit
impl<'de> Deserialize<'de> for Edit
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>,
Auto Trait Implementations§
impl Freeze for Edit
impl RefUnwindSafe for Edit
impl Send for Edit
impl Sync for Edit
impl Unpin for Edit
impl UnsafeUnpin for Edit
impl UnwindSafe for Edit
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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