use std::result;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error("桶数量必须是 2 的幂且大于 0: {0}")]
InvalidBucketCount(usize),
#[error("逻辑地址非法 (0 为保留的无效地址): {0:#x}")]
InvalidAddress(u64),
#[error("逻辑地址超过 48 位限制 (最大 256TB): {0:#x}")]
AddressOverflow(u64),
#[error("溢出桶内存池已耗尽")]
OverflowPoolExhausted,
#[error("检测到哈希桶溢出链存在环或深度超过上限")]
OverflowCycleDetected,
#[error("多键自旋加锁超时")]
LockTimeout,
#[error(transparent)]
Mem(#[from] wram::Error),
}
pub type Result<T> = result::Result<T, Error>;