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 IndexOverflow,
33}
34
35impl fmt::Display for Error {
36 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
37 f.write_str(match self {
38 Self::IndexOverflow => "output index does not fit index width",
39 Self::InvalidTopology => "invalid triangle topology",
40 Self::IndexOutOfBounds => "vertex index out of bounds",
41 Self::InvalidLayout => "invalid vertex layout",
42 Self::InvalidParameter => "invalid parameter",
43 Self::UnknownFlags => "unknown or unsupported flag bits",
44 Self::UnsupportedVersion => "unsupported stream version",
45 Self::BufferTooSmall => "destination buffer too small",
46 Self::InvalidStream => "invalid encoded stream",
47 Self::SizeOverflow => "size overflow",
48 Self::LimitExceeded => "resource limit exceeded",
49 Self::AllocationFailed => "allocation failed",
50 Self::NumericalFailure => "non-finite geometry or calculation",
51 })
52 }
53}
54
55#[cfg(feature = "std")]
56impl std::error::Error for Error {}