meshoptimizer_rs/
error.rs1use core::fmt;
2
3#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5#[non_exhaustive]
6pub enum Error {
7 InvalidTopology,
9 IndexOutOfBounds,
11 InvalidLayout,
13 InvalidParameter,
15 UnknownFlags,
17 UnsupportedVersion,
19 BufferTooSmall,
21 InvalidStream,
23 SizeOverflow,
25 LimitExceeded,
27 AllocationFailed,
29 NumericalFailure,
31}
32
33impl fmt::Display for Error {
34 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
35 f.write_str(match self {
36 Self::InvalidTopology => "invalid triangle topology",
37 Self::IndexOutOfBounds => "vertex index out of bounds",
38 Self::InvalidLayout => "invalid vertex layout",
39 Self::InvalidParameter => "invalid parameter",
40 Self::UnknownFlags => "unknown or unsupported flag bits",
41 Self::UnsupportedVersion => "unsupported stream version",
42 Self::BufferTooSmall => "destination buffer too small",
43 Self::InvalidStream => "invalid encoded stream",
44 Self::SizeOverflow => "size overflow",
45 Self::LimitExceeded => "resource limit exceeded",
46 Self::AllocationFailed => "allocation failed",
47 Self::NumericalFailure => "non-finite geometry or calculation",
48 })
49 }
50}
51
52#[cfg(feature = "std")]
53impl std::error::Error for Error {}