stak_device/device/buffer_error.rs
1use core::{
2 error,
3 fmt::{self, Display, Formatter},
4};
5
6/// A buffer error.
7#[derive(Clone, Debug, Eq, PartialEq)]
8pub enum BufferError {
9 /// A read error.
10 Read,
11 /// A write error.
12 Write,
13}
14
15impl error::Error for BufferError {}
16
17impl Display for BufferError {
18 fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
19 match self {
20 Self::Read => write!(formatter, "failed to read buffer"),
21 Self::Write => write!(formatter, "failed to write buffer"),
22 }
23 }
24}