pub struct Fix {
pub start_byte: usize,
pub end_byte: usize,
pub replacement: String,
pub description: String,
pub safe: bool,
pub confidence: Option<f32>,
pub group: Option<String>,
pub depends_on: Option<String>,
}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: boolLegacy safety flag retained for backwards compatibility.
New code should prefer confidence, is_safe(), and confidence_tier().
confidence: Option<f32>Confidence score (0.0 to 1.0).
- HIGH: >= 0.95
- MEDIUM: >= 0.75 and < 0.95
- LOW: < 0.75
When this is None (legacy serialized payloads), confidence is inferred
from safe for compatibility.
group: Option<String>Optional group key. Fixes in the same group are treated as alternatives.
depends_on: Option<String>Optional dependency key (group or description) required before applying this fix.
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 replace_with_confidence(
start: usize,
end: usize,
replacement: impl Into<String>,
description: impl Into<String>,
confidence: f32,
) -> Self
pub fn replace_with_confidence( start: usize, end: usize, replacement: impl Into<String>, description: impl Into<String>, confidence: f32, ) -> Self
Create a replacement fix with explicit confidence.
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 insert_with_confidence(
position: usize,
text: impl Into<String>,
description: impl Into<String>,
confidence: f32,
) -> Self
pub fn insert_with_confidence( position: usize, text: impl Into<String>, description: impl Into<String>, confidence: f32, ) -> Self
Create an insertion fix with explicit confidence.
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 delete_with_confidence(
start: usize,
end: usize,
description: impl Into<String>,
confidence: f32,
) -> Self
pub fn delete_with_confidence( start: usize, end: usize, description: impl Into<String>, confidence: f32, ) -> Self
Create a deletion fix with explicit confidence.
Sourcepub fn replace_checked(
content: &str,
start: usize,
end: usize,
replacement: impl Into<String>,
description: impl Into<String>,
safe: bool,
) -> Self
pub fn replace_checked( content: &str, start: usize, end: usize, replacement: impl Into<String>, description: impl Into<String>, safe: bool, ) -> Self
Create a replacement fix, asserting UTF-8 char boundary alignment in debug builds.
Validates that both start and end land on UTF-8 char boundaries in content.
These checks are no-ops in release builds; the function otherwise behaves identically to its unchecked counterpart. Use Self::replace when content is not available.
Sourcepub fn replace_with_confidence_checked(
content: &str,
start: usize,
end: usize,
replacement: impl Into<String>,
description: impl Into<String>,
confidence: f32,
) -> Self
pub fn replace_with_confidence_checked( content: &str, start: usize, end: usize, replacement: impl Into<String>, description: impl Into<String>, confidence: f32, ) -> Self
Create a replacement fix with explicit confidence, asserting UTF-8 char boundary alignment in debug builds.
Validates that both start and end land on UTF-8 char boundaries in content.
These checks are no-ops in release builds; the function otherwise behaves identically to its unchecked counterpart. Use Self::replace_with_confidence when
content is not available.
Sourcepub fn insert_checked(
content: &str,
position: usize,
text: impl Into<String>,
description: impl Into<String>,
safe: bool,
) -> Self
pub fn insert_checked( content: &str, position: usize, text: impl Into<String>, description: impl Into<String>, safe: bool, ) -> Self
Create an insertion fix, asserting UTF-8 char boundary alignment in debug builds.
Validates that position lands on a UTF-8 char boundary in content.
These checks are no-ops in release builds; the function otherwise behaves identically to its unchecked counterpart. Use Self::insert when content is not available.
Sourcepub fn insert_with_confidence_checked(
content: &str,
position: usize,
text: impl Into<String>,
description: impl Into<String>,
confidence: f32,
) -> Self
pub fn insert_with_confidence_checked( content: &str, position: usize, text: impl Into<String>, description: impl Into<String>, confidence: f32, ) -> Self
Create an insertion fix with explicit confidence, asserting UTF-8 char boundary alignment in debug builds.
Validates that position lands on a UTF-8 char boundary in content.
These checks are no-ops in release builds; the function otherwise behaves identically to its unchecked counterpart. Use Self::insert_with_confidence when
content is not available.
Sourcepub fn delete_checked(
content: &str,
start: usize,
end: usize,
description: impl Into<String>,
safe: bool,
) -> Self
pub fn delete_checked( content: &str, start: usize, end: usize, description: impl Into<String>, safe: bool, ) -> Self
Create a deletion fix, asserting UTF-8 char boundary alignment in debug builds.
Validates that both start and end land on UTF-8 char boundaries in content.
These checks are no-ops in release builds; the function otherwise behaves identically to its unchecked counterpart. Use Self::delete when content is not available.
Sourcepub fn delete_with_confidence_checked(
content: &str,
start: usize,
end: usize,
description: impl Into<String>,
confidence: f32,
) -> Self
pub fn delete_with_confidence_checked( content: &str, start: usize, end: usize, description: impl Into<String>, confidence: f32, ) -> Self
Create a deletion fix with explicit confidence, asserting UTF-8 char boundary alignment in debug builds.
Validates that both start and end land on UTF-8 char boundaries in content.
These checks are no-ops in release builds; the function otherwise behaves identically to its unchecked counterpart. Use Self::delete_with_confidence when
content is not available.
Sourcepub fn with_confidence(self, confidence: f32) -> Self
pub fn with_confidence(self, confidence: f32) -> Self
Override confidence for this fix and sync legacy safe.
Sourcepub fn with_group(self, group: impl Into<String>) -> Self
pub fn with_group(self, group: impl Into<String>) -> Self
Mark this fix as part of an alternatives group.
Sourcepub fn with_dependency(self, depends_on: impl Into<String>) -> Self
pub fn with_dependency(self, depends_on: impl Into<String>) -> Self
Set a dependency key (group or description) that must be applied first.
Sourcepub fn confidence_score(&self) -> f32
pub fn confidence_score(&self) -> f32
Resolve confidence score with legacy fallback.
Sourcepub fn confidence_tier(&self) -> FixConfidenceTier
pub fn confidence_tier(&self) -> FixConfidenceTier
Confidence tier used for certainty filtering.
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>,
impl Eq for Fix
Auto Trait Implementations§
impl Freeze for Fix
impl RefUnwindSafe for Fix
impl Send for Fix
impl Sync for Fix
impl Unpin for Fix
impl UnsafeUnpin 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
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§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