1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use core::fmt;
/// Checked input, resource, allocation, or numerical failure.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum Error {
/// A triangle list does not contain a multiple of three indices.
InvalidTopology,
/// An index does not identify a supplied vertex.
IndexOutOfBounds,
/// A vertex view has an invalid stride, width, offset, or length.
InvalidLayout,
/// A parameter is outside the operation's supported domain.
InvalidParameter,
/// A vertex flag or option mask contains unknown or unsupported bits.
UnknownFlags,
/// A codec version is unsupported.
UnsupportedVersion,
/// A caller destination is too small.
BufferTooSmall,
/// An encoded stream is malformed.
InvalidStream,
/// Size arithmetic or a platform allocation bound overflowed.
SizeOverflow,
/// The per-call storage or counted-work limit was exceeded.
LimitExceeded,
/// A fallible allocation failed.
AllocationFailed,
/// Geometry or an intermediate calculation is non-finite.
NumericalFailure,
/// An output vertex index cannot fit the requested index width.
IndexOverflow,
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match self {
Self::IndexOverflow => "output index does not fit index width",
Self::InvalidTopology => "invalid triangle topology",
Self::IndexOutOfBounds => "vertex index out of bounds",
Self::InvalidLayout => "invalid vertex layout",
Self::InvalidParameter => "invalid parameter",
Self::UnknownFlags => "unknown or unsupported flag bits",
Self::UnsupportedVersion => "unsupported stream version",
Self::BufferTooSmall => "destination buffer too small",
Self::InvalidStream => "invalid encoded stream",
Self::SizeOverflow => "size overflow",
Self::LimitExceeded => "resource limit exceeded",
Self::AllocationFailed => "allocation failed",
Self::NumericalFailure => "non-finite geometry or calculation",
})
}
}
#[cfg(feature = "std")]
impl std::error::Error for Error {}