pub struct PatternLibrary { /* private fields */ }Expand description
Library of error patterns for ownership inference.
Supports curriculum ordering and pattern matching for error recovery.
Implementations§
Source§impl PatternLibrary
impl PatternLibrary
Sourcepub fn add(&mut self, pattern: ErrorPattern)
pub fn add(&mut self, pattern: ErrorPattern)
Add a pattern to the library.
Sourcepub fn get(&self, id: &str) -> Option<&ErrorPattern>
pub fn get(&self, id: &str) -> Option<&ErrorPattern>
Get a pattern by ID.
Sourcepub fn get_mut(&mut self, id: &str) -> Option<&mut ErrorPattern>
pub fn get_mut(&mut self, id: &str) -> Option<&mut ErrorPattern>
Get a mutable pattern by ID.
Sourcepub fn get_by_error_kind(&self, kind: OwnershipErrorKind) -> Vec<&ErrorPattern>
pub fn get_by_error_kind(&self, kind: OwnershipErrorKind) -> Vec<&ErrorPattern>
Get all patterns matching an error kind.
Sourcepub fn curriculum_ordered(&self) -> Vec<&ErrorPattern>
pub fn curriculum_ordered(&self) -> Vec<&ErrorPattern>
Get patterns ordered by curriculum level (easiest first).
Sourcepub fn match_rust_error(&self, error_msg: &str) -> Vec<&ErrorPattern>
pub fn match_rust_error(&self, error_msg: &str) -> Vec<&ErrorPattern>
Match patterns against a Rust error message.
Sourcepub fn iter(&self) -> impl Iterator<Item = &ErrorPattern>
pub fn iter(&self) -> impl Iterator<Item = &ErrorPattern>
Iterate over all patterns.
Trait Implementations§
Source§impl Clone for PatternLibrary
impl Clone for PatternLibrary
Source§fn clone(&self) -> PatternLibrary
fn clone(&self) -> PatternLibrary
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 PatternLibrary
impl Debug for PatternLibrary
Source§impl Default for PatternLibrary
impl Default for PatternLibrary
Source§fn default() -> PatternLibrary
fn default() -> PatternLibrary
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for PatternLibrary
impl<'de> Deserialize<'de> for PatternLibrary
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 PatternLibrary
impl RefUnwindSafe for PatternLibrary
impl Send for PatternLibrary
impl Sync for PatternLibrary
impl Unpin for PatternLibrary
impl UnwindSafe for PatternLibrary
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