pub struct Errors<Prim: PrimitiveType> { /* private fields */ }Expand description
List of Errors.
§Examples
let buggy_code = Annotated::<F32Grammar>::parse_statements(r#"
numbers: ['T; _] = (1, 2, 3);
numbers.filter(|x| x, 1)
"#)?;
let mut env: TypeEnvironment = Prelude::iter().collect();
let errors: Errors<_> = env.process_statements(&buggy_code).unwrap_err();
assert_eq!(errors.len(), 3);
let messages: HashSet<_> = errors.iter().map(ToString::to_string).collect();
assert!(messages
.iter()
.any(|msg| msg.contains("Type param `T` is not scoped by function definition")));
assert!(messages
.contains("3:20: Type `Num` is not assignable to type `Bool`"));
assert!(messages
.contains("3:5: Function expects 2 args, but is called with 3 args"));Implementations§
Source§impl<Prim: PrimitiveType> Errors<Prim>
impl<Prim: PrimitiveType> Errors<Prim>
Sourcepub fn iter(&self) -> impl Iterator<Item = &Error<Prim>> + '_
pub fn iter(&self) -> impl Iterator<Item = &Error<Prim>> + '_
Iterates over errors contained in this list.
Sourcepub fn first_failing_statement(&self) -> usize
pub fn first_failing_statement(&self) -> usize
Returns the index of the first failing statement within a Block that has errored.
If the error is in the return value, this index will be equal to the number of statements
in the block.
Trait Implementations§
Source§impl<Prim: PrimitiveType> Display for Errors<Prim>
impl<Prim: PrimitiveType> Display for Errors<Prim>
Source§impl<Prim: PrimitiveType> Error for Errors<Prim>
Available on crate feature std only.
impl<Prim: PrimitiveType> Error for Errors<Prim>
Available on crate feature
std only.1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl<Prim: PrimitiveType> IntoIterator for Errors<Prim>
impl<Prim: PrimitiveType> IntoIterator for Errors<Prim>
Auto Trait Implementations§
impl<Prim> Freeze for Errors<Prim>
impl<Prim> !RefUnwindSafe for Errors<Prim>
impl<Prim> Send for Errors<Prim>
impl<Prim> Sync for Errors<Prim>
impl<Prim> Unpin for Errors<Prim>where
Prim: Unpin,
impl<Prim> !UnwindSafe for Errors<Prim>
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