pub enum ValidationError {
SyntaxError {
message: String,
line: usize,
column: usize,
end_line: Option<usize>,
end_column: Option<usize>,
},
TypeError {
message: String,
location: String,
expected_type: Option<String>,
found_type: Option<String>,
suggestion: Option<String>,
},
UnitError {
expected: Dimension,
found: Dimension,
location: String,
suggestion: Option<String>,
},
ScopeError {
variable: String,
available_in: Vec<String>,
location: String,
suggestion: Option<String>,
},
DeterminismError {
message: String,
hint: String,
},
UndefinedReference {
reference_type: ReferenceType,
name: String,
location: String,
suggestion: Option<String>,
},
DuplicateDeclaration {
name: String,
first_location: String,
second_location: String,
},
InvalidExpression {
message: String,
location: String,
suggestion: Option<String>,
},
}Variants§
SyntaxError
TypeError
Fields
UnitError
ScopeError
DeterminismError
UndefinedReference
DuplicateDeclaration
InvalidExpression
Implementations§
Source§impl ValidationError
impl ValidationError
Sourcepub fn error_code(&self) -> ErrorCode
pub fn error_code(&self) -> ErrorCode
Get the error code for this validation error
Sourcepub fn range(&self) -> Option<SourceRange>
pub fn range(&self) -> Option<SourceRange>
Get the source range for this error (if available)
Sourcepub fn location_string(&self) -> Option<String>
pub fn location_string(&self) -> Option<String>
Get a user-friendly location string
pub fn syntax_error( message: impl Into<String>, line: usize, column: usize, ) -> Self
pub fn syntax_error_with_range( message: impl Into<String>, line: usize, column: usize, end_line: usize, end_column: usize, ) -> Self
pub fn type_error( message: impl Into<String>, location: impl Into<String>, ) -> Self
pub fn unit_error( expected: Dimension, found: Dimension, location: impl Into<String>, ) -> Self
pub fn scope_error( variable: impl Into<String>, available_in: Vec<String>, location: impl Into<String>, ) -> Self
pub fn determinism_error( message: impl Into<String>, hint: impl Into<String>, ) -> Self
pub fn undefined_reference( reference_type: impl Into<String>, name: impl Into<String>, location: impl Into<String>, ) -> Self
pub fn duplicate_declaration( name: impl Into<String>, first_location: impl Into<String>, second_location: impl Into<String>, ) -> Self
pub fn invalid_expression( message: impl Into<String>, location: impl Into<String>, ) -> Self
pub fn with_suggestion(self, suggestion: impl Into<String>) -> Self
pub fn with_types( self, expected_type: impl Into<String>, found_type: impl Into<String>, ) -> Self
Sourcepub fn undefined_entity(
name: impl Into<String>,
location: impl Into<String>,
) -> Self
pub fn undefined_entity( name: impl Into<String>, location: impl Into<String>, ) -> Self
Create an error for an undefined Entity with a helpful suggestion
Sourcepub fn undefined_resource(
name: impl Into<String>,
location: impl Into<String>,
) -> Self
pub fn undefined_resource( name: impl Into<String>, location: impl Into<String>, ) -> Self
Create an error for an undefined Resource with a helpful suggestion
Sourcepub fn undefined_flow(
name: impl Into<String>,
location: impl Into<String>,
) -> Self
pub fn undefined_flow( name: impl Into<String>, location: impl Into<String>, ) -> Self
Create an error for an undefined Flow with a helpful suggestion
Sourcepub fn unit_mismatch(
expected: Dimension,
found: Dimension,
location: impl Into<String>,
) -> Self
pub fn unit_mismatch( expected: Dimension, found: Dimension, location: impl Into<String>, ) -> Self
Create a unit mismatch error with automatic suggestion
Sourcepub fn type_mismatch(
expected: impl Into<String>,
found: impl Into<String>,
location: impl Into<String>,
) -> Self
pub fn type_mismatch( expected: impl Into<String>, found: impl Into<String>, location: impl Into<String>, ) -> Self
Create a type mismatch error with types and suggestion
Sourcepub fn variable_not_in_scope(
variable: impl Into<String>,
available: Vec<String>,
location: impl Into<String>,
) -> Self
pub fn variable_not_in_scope( variable: impl Into<String>, available: Vec<String>, location: impl Into<String>, ) -> Self
Create a scope error with available variables listed
Sourcepub fn undefined_entity_with_candidates(
name: impl Into<String>,
location: impl Into<String>,
candidates: &[String],
) -> Self
pub fn undefined_entity_with_candidates( name: impl Into<String>, location: impl Into<String>, candidates: &[String], ) -> Self
Create an undefined entity error with fuzzy matching suggestions
§Arguments
name- The undefined entity namelocation- Source location of the errorcandidates- Available entity names to suggest
Trait Implementations§
Source§impl Clone for ValidationError
impl Clone for ValidationError
Source§fn clone(&self) -> ValidationError
fn clone(&self) -> ValidationError
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 ValidationError
impl Debug for ValidationError
Source§impl Display for ValidationError
impl Display for ValidationError
Source§impl Error for ValidationError
impl Error for ValidationError
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()
Auto Trait Implementations§
impl Freeze for ValidationError
impl RefUnwindSafe for ValidationError
impl Send for ValidationError
impl Sync for ValidationError
impl Unpin for ValidationError
impl UnwindSafe for ValidationError
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