use core::error::Error;
use core::fmt;
#[derive(Debug)]
pub struct BorrowError;
impl fmt::Display for BorrowError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"Cannot borrow the value because it is already exclusively borrowed or the cell does not contain a value.",
)
}
}
impl Error for BorrowError {}
#[derive(Debug)]
pub struct BorrowMutError;
impl fmt::Display for BorrowMutError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"Cannot exclusively borrow the value because it is already borrowed or the cell does not contain a value.",
)
}
}
impl Error for BorrowMutError {}
#[derive(Debug)]
pub struct ConsumeError;
impl fmt::Display for ConsumeError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"Cannot consume the value because the cell does not fully own it.",
)
}
}
impl Error for ConsumeError {}