pub enum EditFix {
MoveHistoryToFront,
DeclareCustomAttribute {
key: String,
},
DropDuplicateKey {
key: String,
kept: String,
},
RemoveRetiredLinksKey {
key: String,
},
RestoreTitle {
title: String,
},
}Expand description
A machine-applicable repair.
“Machine-applicable” is the whole bar: a fix is only offered when tix can perform it without guessing at what the author meant. Prose problems get no fix, only a proposal, because a tool that rewrites a user’s words is worse than one that says “here is the file, fix it”.
Variants§
MoveHistoryToFront
Move the misplaced ## History heading and its whole entry block to the
top of the body, byte-for-byte.
DeclareCustomAttribute
Declare key in tix.toml’s [custom_attributes]. Applied by the app
(it writes tix.toml), not by rewriting the issue file.
DropDuplicateKey
Drop the later occurrence of key, keeping the first.
RemoveRetiredLinksKey
Remove the retired links: key and its block.
RestoreTitle
Put the pre-edit title back.
Implementations§
Source§impl EditFix
impl EditFix
Sourcepub const fn is_text_fix(&self) -> bool
pub const fn is_text_fix(&self) -> bool
Whether the fix is a rewrite of the issue text, as opposed to an action
the app performs elsewhere (declaring a key writes tix.toml).
Sourcepub fn apply(&self, contents: &str) -> Option<String>
pub fn apply(&self, contents: &str) -> Option<String>
Apply the fix to contents, returning the repaired text.
None when the fix cannot be applied — the declared-key fix is not a
text edit at all, and the text fixes refuse rather than guess when the
shape they expect is absent. A None means the caller must leave the
file untouched.
Trait Implementations§
impl Eq for EditFix
impl StructuralPartialEq for EditFix
Auto Trait Implementations§
impl Freeze for EditFix
impl RefUnwindSafe for EditFix
impl Send for EditFix
impl Sync for EditFix
impl Unpin for EditFix
impl UnsafeUnpin for EditFix
impl UnwindSafe for EditFix
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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