pub enum GeometryError {
NonFiniteComponent {
type_name: &'static str,
component: &'static str,
value: f64,
},
NegativeRadius(f64),
NonFiniteRadius(f64),
NonFiniteTolerance(f64),
NegativeTolerance(f64),
IdenticalPoints,
ZeroDirectionVector,
InvalidBounds {
min_x: f64,
min_y: f64,
max_x: f64,
max_y: f64,
},
}Expand description
Errors returned by validated geometry constructors and tolerance-aware helpers.
Variants§
NonFiniteComponent
A geometry component must be finite.
The type name, component name, and invalid value are included for diagnostics.
Fields
NegativeRadius(f64)
A circle radius cannot be negative.
NonFiniteRadius(f64)
A circle radius must be finite.
NonFiniteTolerance(f64)
A tolerance must be finite.
NegativeTolerance(f64)
A tolerance cannot be negative.
IdenticalPoints
Distinct points were required but identical points were supplied.
ZeroDirectionVector
A non-zero direction vector was required.
InvalidBounds
An axis-aligned bounding box corner ordering was invalid.
Implementations§
Source§impl GeometryError
impl GeometryError
Sourcepub const fn non_finite_component(
type_name: &'static str,
component: &'static str,
value: f64,
) -> Self
pub const fn non_finite_component( type_name: &'static str, component: &'static str, value: f64, ) -> Self
Builds a non-finite component error for a named public type and field.
Sourcepub const fn validate_tolerance(tolerance: f64) -> Result<f64, Self>
pub const fn validate_tolerance(tolerance: f64) -> Result<f64, Self>
Validates a tolerance used by geometry APIs.
§Errors
Returns GeometryError::NonFiniteTolerance when tolerance is NaN
or infinite.
Returns GeometryError::NegativeTolerance when tolerance is negative.
Trait Implementations§
Source§impl Clone for GeometryError
impl Clone for GeometryError
Source§fn clone(&self) -> GeometryError
fn clone(&self) -> GeometryError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GeometryError
impl Debug for GeometryError
Source§impl Display for GeometryError
impl Display for GeometryError
Source§impl Error for GeometryError
impl Error for GeometryError
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()
Source§impl PartialEq for GeometryError
impl PartialEq for GeometryError
Source§fn eq(&self, other: &GeometryError) -> bool
fn eq(&self, other: &GeometryError) -> bool
self and other values to be equal, and is used by ==.