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<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for 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.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.