pub struct Fix {
pub start_byte: usize,
pub end_byte: usize,
pub replacement: String,
pub description: String,
pub safe: bool,
}Expand description
An automatic fix for a diagnostic
Fields§
§start_byte: usizeByte offset start (inclusive)
end_byte: usizeByte offset end (exclusive)
replacement: StringText to insert/replace with
description: StringHuman-readable description of what this fix does
safe: boolWhether this fix is safe (HIGH certainty, >95%)
Implementations§
Source§impl Fix
impl Fix
Sourcepub fn replace(
start: usize,
end: usize,
replacement: impl Into<String>,
description: impl Into<String>,
safe: bool,
) -> Self
pub fn replace( start: usize, end: usize, replacement: impl Into<String>, description: impl Into<String>, safe: bool, ) -> Self
Create a replacement fix
Sourcepub fn insert(
position: usize,
text: impl Into<String>,
description: impl Into<String>,
safe: bool,
) -> Self
pub fn insert( position: usize, text: impl Into<String>, description: impl Into<String>, safe: bool, ) -> Self
Create an insertion fix (start == end)
Sourcepub fn delete(
start: usize,
end: usize,
description: impl Into<String>,
safe: bool,
) -> Self
pub fn delete( start: usize, end: usize, description: impl Into<String>, safe: bool, ) -> Self
Create a deletion fix (replacement is empty)
Sourcepub fn is_insertion(&self) -> bool
pub fn is_insertion(&self) -> bool
Check if this is an insertion (start == end)
Sourcepub fn is_deletion(&self) -> bool
pub fn is_deletion(&self) -> bool
Check if this is a deletion (empty replacement)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Fix
impl<'de> Deserialize<'de> for Fix
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Fix
impl RefUnwindSafe for Fix
impl Send for Fix
impl Sync for Fix
impl Unpin for Fix
impl UnwindSafe for Fix
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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