pub enum Error {
General(String),
OutOfRange {
name: &'static str,
value: f64,
min: f64,
max: f64,
},
InvalidMesh {
reason: String,
},
LengthMismatch {
expected: usize,
actual: usize,
},
ConvergenceFailure {
operation: &'static str,
iterations: usize,
residual: f64,
},
IndexOutOfBounds {
index: usize,
len: usize,
},
TooFewPoints {
required: usize,
actual: usize,
},
DegenerateGeometry {
details: String,
},
DimensionMismatch {
lhs: &'static str,
lhs_len: usize,
rhs: &'static str,
rhs_len: usize,
},
Unsupported {
operation: &'static str,
reason: String,
},
Io {
context: &'static str,
message: String,
},
}Expand description
Main error type for the geometry module.
Variants§
General(String)
Generic catch-all error with a human-readable message.
OutOfRange
A required parameter was out of its valid range.
Fields
InvalidMesh
A mesh is topologically or geometrically invalid.
LengthMismatch
A buffer had the wrong length.
ConvergenceFailure
Numerical computation did not converge.
Fields
IndexOutOfBounds
An index was out of bounds for the given container.
TooFewPoints
A shape requires at least a minimum number of vertices/points.
DegenerateGeometry
A degenerate geometry was encountered (zero area, zero volume, etc.).
DimensionMismatch
Two arrays that must have equal length do not.
Fields
Unsupported
A requested feature or algorithm is not supported for this input.
Io
An I/O error occurred during geometry serialization or deserialization.
Implementations§
Source§impl Error
impl Error
Sourcepub fn general(msg: impl Into<String>) -> Self
pub fn general(msg: impl Into<String>) -> Self
Create a General error from any string-like value.
Sourcepub fn out_of_range(name: &'static str, value: f64, min: f64, max: f64) -> Self
pub fn out_of_range(name: &'static str, value: f64, min: f64, max: f64) -> Self
Create an OutOfRange error.
Sourcepub fn invalid_mesh(reason: impl Into<String>) -> Self
pub fn invalid_mesh(reason: impl Into<String>) -> Self
Create an InvalidMesh error.
Sourcepub fn length_mismatch(expected: usize, actual: usize) -> Self
pub fn length_mismatch(expected: usize, actual: usize) -> Self
Create a LengthMismatch error.
Sourcepub fn convergence_failure(
operation: &'static str,
iterations: usize,
residual: f64,
) -> Self
pub fn convergence_failure( operation: &'static str, iterations: usize, residual: f64, ) -> Self
Create a ConvergenceFailure error.
Sourcepub fn index_out_of_bounds(index: usize, len: usize) -> Self
pub fn index_out_of_bounds(index: usize, len: usize) -> Self
Create an IndexOutOfBounds error.
Sourcepub fn too_few_points(required: usize, actual: usize) -> Self
pub fn too_few_points(required: usize, actual: usize) -> Self
Create a TooFewPoints error.
Sourcepub fn degenerate_geometry(details: impl Into<String>) -> Self
pub fn degenerate_geometry(details: impl Into<String>) -> Self
Create a DegenerateGeometry error.
Sourcepub fn dimension_mismatch(
lhs: &'static str,
lhs_len: usize,
rhs: &'static str,
rhs_len: usize,
) -> Self
pub fn dimension_mismatch( lhs: &'static str, lhs_len: usize, rhs: &'static str, rhs_len: usize, ) -> Self
Create a DimensionMismatch error.
Sourcepub fn unsupported(operation: &'static str, reason: impl Into<String>) -> Self
pub fn unsupported(operation: &'static str, reason: impl Into<String>) -> Self
Create an Unsupported error.
Sourcepub fn is_general(&self) -> bool
pub fn is_general(&self) -> bool
Returns true if this is a General error.
Sourcepub fn is_length_mismatch(&self) -> bool
pub fn is_length_mismatch(&self) -> bool
Returns true if this is a LengthMismatch error.
Sourcepub fn is_convergence_failure(&self) -> bool
pub fn is_convergence_failure(&self) -> bool
Returns true if this is a convergence failure.
Sourcepub fn is_index_out_of_bounds(&self) -> bool
pub fn is_index_out_of_bounds(&self) -> bool
Returns true if this is an index-out-of-bounds error.
Sourcepub fn is_degenerate(&self) -> bool
pub fn is_degenerate(&self) -> bool
Returns true if this error indicates degenerate geometry.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl UnwindSafe for Error
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.