pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error(
"overrun: the writer is {behind} bytes ahead of this reader, more than the queue holds"
)]
Overrun {
behind: u64,
},
#[error("buffer of {provided} bytes cannot hold a {needed}-byte frame")]
BufferTooSmall {
needed: usize,
provided: usize,
},
#[error("message of {len} bytes exceeds the maximum of {max} for this queue")]
MessageTooLarge {
len: usize,
max: usize,
},
#[error("capacity {0} must be a power of two and at least {min}", min = crate::layout::MIN_CAPACITY)]
BadCapacity(u64),
#[error("not an outcry queue: {0}")]
BadHeader(&'static str),
#[error("io: {0}")]
Io(#[from] std::io::Error),
}