molgfx_math/bounds/
bvh_error.rs1use std::fmt;
4
5#[derive(Clone, Copy, PartialEq, Eq, Debug)]
7pub struct BvhBuildError {
8 pub(super) resource: &'static str,
9 pub(super) index: u64,
10 pub(super) maximum: u32,
11}
12
13impl BvhBuildError {
14 #[must_use]
16 pub const fn resource(self) -> &'static str {
17 self.resource
18 }
19
20 #[must_use]
22 pub const fn index(self) -> u64 {
23 self.index
24 }
25
26 #[must_use]
28 pub const fn maximum(self) -> u32 {
29 self.maximum
30 }
31}
32
33impl fmt::Display for BvhBuildError {
34 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
35 write!(
36 formatter,
37 "{} index {} exceeds the GPU limit {}",
38 self.resource, self.index, self.maximum
39 )
40 }
41}
42
43impl std::error::Error for BvhBuildError {}