Skip to main content

sightloom_tracking/
error.rs

1//! Tracker errors.
2
3use core::fmt;
4
5/// An error produced by tracking operations.
6#[derive(Clone, Copy, Debug, Eq, PartialEq)]
7pub enum TrackError {
8    /// A numeric input is NaN or infinite.
9    NonFinite,
10    /// Caller-owned storage cannot hold another track or assignment.
11    InsufficientCapacity,
12    /// A configuration threshold is invalid.
13    InvalidConfig,
14}
15
16impl fmt::Display for TrackError {
17    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18        f.write_str(match self {
19            Self::NonFinite => "non-finite tracking value",
20            Self::InsufficientCapacity => "insufficient tracking capacity",
21            Self::InvalidConfig => "invalid tracker config",
22        })
23    }
24}
25
26#[cfg(feature = "std")]
27impl std::error::Error for TrackError {}