stak_device/device/
buffer_error.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use core::{
    error,
    fmt::{self, Display, Formatter},
};

/// A buffer error.
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum BufferError {
    /// A read error.
    Read,
    /// A write error.
    Write,
}

impl error::Error for BufferError {}

impl Display for BufferError {
    fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
        match self {
            Self::Read => write!(formatter, "failed to read buffer"),
            Self::Write => write!(formatter, "failed to write buffer"),
        }
    }
}