1use std::fmt;
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq)]
7pub enum QueryError {
8 MeshMismatch,
10 StaleBvh,
12 InvalidInput(&'static str),
14 OutOfMemory,
16}
17
18impl fmt::Display for QueryError {
19 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20 match self {
21 QueryError::MeshMismatch => f.write_str("the BVH was built for a different mesh"),
22 QueryError::StaleBvh => f.write_str("the BVH is out of date with the mesh"),
23 QueryError::InvalidInput(what) => write!(f, "invalid input: {what}"),
24 QueryError::OutOfMemory => f.write_str("out of memory"),
25 }
26 }
27}
28
29impl std::error::Error for QueryError {}
30
31pub type Result<T> = std::result::Result<T, QueryError>;