zone_alloc/
borrow_error.rs1use core::{
2 error::Error,
3 fmt::Display,
4};
5
6#[derive(Debug, PartialEq, Eq)]
8pub enum BorrowError {
9 OutOfBounds,
11 AlreadyBorrowedMutably,
13 AlreadyBorrowed,
15}
16
17impl Display for BorrowError {
18 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
19 match self {
20 Self::OutOfBounds => write!(f, "element is out of bounds"),
21 Self::AlreadyBorrowedMutably => write!(f, "element is already borrowed mutably"),
22 Self::AlreadyBorrowed => write!(f, "element is already borrowed"),
23 }
24 }
25}
26
27impl Error for BorrowError {}