#![cfg_attr(not(feature = "std"), no_std)]
#![warn(missing_docs)]
use core::fmt::{self, Display, Debug};
#[cfg(feature = "std")]
mod reusable_id_pool;
mod reusable_id_pool_manual;
#[cfg(feature = "std")]
pub use crate::reusable_id_pool::{ReusableIdPool, ArcId};
pub use crate::reusable_id_pool_manual::ReusableIdPoolManual;
pub enum ReusableIdPoolError {
TooManyLiveIDs,
}
impl Display for ReusableIdPoolError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::TooManyLiveIDs => write!(f, "There are too many IDs concurrently in use. The limit is (2^64 - 1) live IDs. Please return some IDs to the pool."),
}
}
}
impl Debug for ReusableIdPoolError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::TooManyLiveIDs => write!(f, "{} (TooManyLiveIDs)", self),
}
}
}
#[cfg(feature = "std")]
impl std::error::Error for ReusableIdPoolError {}