Skip to main content

Error

Enum Error 

Source
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

§name: &'static str

Name of the parameter.

§value: f64

Actual value supplied.

§min: f64

Inclusive lower bound.

§max: f64

Inclusive upper bound.

§

InvalidMesh

A mesh is topologically or geometrically invalid.

Fields

§reason: String

Human-readable description of the problem.

§

LengthMismatch

A buffer had the wrong length.

Fields

§expected: usize

Expected length.

§actual: usize

Actual length.

§

ConvergenceFailure

Numerical computation did not converge.

Fields

§operation: &'static str

Name of the operation that failed.

§iterations: usize

Number of iterations attempted.

§residual: f64

Final residual value.

§

IndexOutOfBounds

An index was out of bounds for the given container.

Fields

§index: usize

The invalid index.

§len: usize

The length of the container.

§

TooFewPoints

A shape requires at least a minimum number of vertices/points.

Fields

§required: usize

Minimum required.

§actual: usize

Actual count.

§

DegenerateGeometry

A degenerate geometry was encountered (zero area, zero volume, etc.).

Fields

§details: String

Description of the degenerate case.

§

DimensionMismatch

Two arrays that must have equal length do not.

Fields

§lhs: &'static str

Name of the first array.

§lhs_len: usize

Length of the first array.

§rhs: &'static str

Name of the second array.

§rhs_len: usize

Length of the second array.

§

Unsupported

A requested feature or algorithm is not supported for this input.

Fields

§operation: &'static str

Name of the operation.

§reason: String

Reason it is unsupported.

§

Io

An I/O error occurred during geometry serialization or deserialization.

Fields

§context: &'static str

The operation context (e.g. “serialize heightfield”).

§message: String

Human-readable message.

Implementations§

Source§

impl Error

Source

pub fn general(msg: impl Into<String>) -> Self

Create a General error from any string-like value.

Source

pub fn out_of_range(name: &'static str, value: f64, min: f64, max: f64) -> Self

Create an OutOfRange error.

Source

pub fn invalid_mesh(reason: impl Into<String>) -> Self

Create an InvalidMesh error.

Source

pub fn length_mismatch(expected: usize, actual: usize) -> Self

Create a LengthMismatch error.

Source

pub fn convergence_failure( operation: &'static str, iterations: usize, residual: f64, ) -> Self

Create a ConvergenceFailure error.

Source

pub fn index_out_of_bounds(index: usize, len: usize) -> Self

Create an IndexOutOfBounds error.

Source

pub fn too_few_points(required: usize, actual: usize) -> Self

Create a TooFewPoints error.

Source

pub fn degenerate_geometry(details: impl Into<String>) -> Self

Create a DegenerateGeometry error.

Source

pub fn dimension_mismatch( lhs: &'static str, lhs_len: usize, rhs: &'static str, rhs_len: usize, ) -> Self

Create a DimensionMismatch error.

Source

pub fn unsupported(operation: &'static str, reason: impl Into<String>) -> Self

Create an Unsupported error.

Source

pub fn io(context: &'static str, message: impl Into<String>) -> Self

Create an Io error.

Source

pub fn is_general(&self) -> bool

Returns true if this is a General error.

Source

pub fn is_length_mismatch(&self) -> bool

Returns true if this is a LengthMismatch error.

Source

pub fn is_convergence_failure(&self) -> bool

Returns true if this is a convergence failure.

Source

pub fn is_index_out_of_bounds(&self) -> bool

Returns true if this is an index-out-of-bounds error.

Source

pub fn is_degenerate(&self) -> bool

Returns true if this error indicates degenerate geometry.

Trait Implementations§

Source§

impl Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for Error

1.30.0 · Source§

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

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.