pub struct ErrorPattern { /* private fields */ }Expand description
An ownership inference error pattern.
Represents a specific C pattern that causes ownership inference failures, along with metadata for curriculum learning and error recovery.
Implementations§
Source§impl ErrorPattern
impl ErrorPattern
Sourcepub fn new(
id: impl Into<String>,
error_kind: OwnershipErrorKind,
description: impl Into<String>,
) -> Self
pub fn new( id: impl Into<String>, error_kind: OwnershipErrorKind, description: impl Into<String>, ) -> Self
Create a new error pattern.
Sourcepub fn with_c_pattern(self, pattern: impl Into<String>) -> Self
pub fn with_c_pattern(self, pattern: impl Into<String>) -> Self
Set the C pattern example.
Sourcepub fn with_rust_error(self, error: impl Into<String>) -> Self
pub fn with_rust_error(self, error: impl Into<String>) -> Self
Set the Rust error message.
Sourcepub fn with_fix(self, fix: SuggestedFix) -> Self
pub fn with_fix(self, fix: SuggestedFix) -> Self
Set the suggested fix.
Sourcepub fn with_severity(self, severity: ErrorSeverity) -> Self
pub fn with_severity(self, severity: ErrorSeverity) -> Self
Set severity level.
Sourcepub fn with_curriculum_level(self, level: u8) -> Self
pub fn with_curriculum_level(self, level: u8) -> Self
Set curriculum level.
Sourcepub fn error_kind(&self) -> OwnershipErrorKind
pub fn error_kind(&self) -> OwnershipErrorKind
Get error kind.
Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
Get description.
Sourcepub fn rust_error(&self) -> Option<&str>
pub fn rust_error(&self) -> Option<&str>
Get Rust error.
Sourcepub fn suggested_fix(&self) -> Option<&SuggestedFix>
pub fn suggested_fix(&self) -> Option<&SuggestedFix>
Get suggested fix.
Sourcepub fn severity(&self) -> ErrorSeverity
pub fn severity(&self) -> ErrorSeverity
Get severity.
Sourcepub fn curriculum_level(&self) -> u8
pub fn curriculum_level(&self) -> u8
Get curriculum level.
Sourcepub fn record_occurrence(&mut self)
pub fn record_occurrence(&mut self)
Increment occurrence count.
Sourcepub fn occurrence_count(&self) -> u64
pub fn occurrence_count(&self) -> u64
Get occurrence count.
Trait Implementations§
Source§impl Clone for ErrorPattern
impl Clone for ErrorPattern
Source§fn clone(&self) -> ErrorPattern
fn clone(&self) -> ErrorPattern
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ErrorPattern
impl Debug for ErrorPattern
Source§impl<'de> Deserialize<'de> for ErrorPattern
impl<'de> Deserialize<'de> for ErrorPattern
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 ErrorPattern
impl RefUnwindSafe for ErrorPattern
impl Send for ErrorPattern
impl Sync for ErrorPattern
impl Unpin for ErrorPattern
impl UnwindSafe for ErrorPattern
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