shared_bytes/errors.rs
1use std::{error::Error, fmt};
2
3#[derive(Debug, Clone)] // Not Copy because we might add a String to this struct later on.
4pub struct IndexOutOfBounds(());
5
6impl IndexOutOfBounds {
7 pub(crate) fn new() -> Self {
8 Self(())
9 }
10}
11
12impl fmt::Display for IndexOutOfBounds {
13 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14 f.write_str("index out of bounds")
15 }
16}
17
18impl Error for IndexOutOfBounds {}