#![doc = include_str!("../README.md")]
#![no_std]
extern crate alloc;
mod any_index_map;
mod any_sparse_map;
pub mod id;
pub mod type_pool;
pub mod type_table;
pub(crate) use maybe_send::MaybeSend;
pub(crate) use maybe_sync::MaybeSync;
#[cfg(feature = "send")]
mod maybe_send {
pub trait MaybeSend: Send {}
impl<T: Send + ?Sized> MaybeSend for T {}
}
#[cfg(not(feature = "send"))]
mod maybe_send {
pub trait MaybeSend {}
impl<T: ?Sized> MaybeSend for T {}
}
#[cfg(feature = "sync")]
mod maybe_sync {
pub trait MaybeSync: Sync {}
impl<T: Sync + ?Sized> MaybeSync for T {}
}
#[cfg(not(feature = "sync"))]
mod maybe_sync {
pub trait MaybeSync {}
impl<T: ?Sized> MaybeSync for T {}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ColumnId(usize);
impl ColumnId {
pub const PLACEHOLDER: Self = Self(usize::MAX);
pub(crate) fn new(index: usize) -> Self {
Self(index)
}
pub fn index(self) -> usize {
self.0
}
}
#[cfg(all(test, feature = "send"))]
mod send_tests {
use crate::type_pool::TypePool;
use crate::type_table::TypeTable;
fn assert_send<T: Send>() {}
#[test]
fn stores_are_send() {
assert_send::<TypePool>();
assert_send::<TypeTable<u32>>();
}
}
#[cfg(all(test, feature = "sync"))]
mod sync_tests {
use crate::type_pool::TypePool;
use crate::type_table::TypeTable;
fn assert_sync<T: Sync>() {}
#[test]
fn stores_are_sync() {
assert_sync::<TypePool>();
assert_sync::<TypeTable<u32>>();
}
}