byteor_pipeline_spec/
error.rs

1//! Spec errors.
2
3/// Validation/decoding errors.
4#[derive(Clone, Debug, PartialEq, Eq)]
5pub struct SpecError {
6    msg: &'static str,
7}
8
9impl SpecError {
10    /// Create a new error.
11    pub const fn new(msg: &'static str) -> Self {
12        Self { msg }
13    }
14
15    /// Error message.
16    pub const fn message(&self) -> &'static str {
17        self.msg
18    }
19}
20
21impl core::fmt::Display for SpecError {
22    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
23        write!(f, "{}", self.msg)
24    }
25}
26
27#[cfg(feature = "std")]
28impl std::error::Error for SpecError {}