1
0
Fork 0
forked from wry/wry

criteria: add infrastructure

This commit is contained in:
Julian Orth 2025-05-02 16:52:04 +02:00
parent 597636fba6
commit 17e715cde4
18 changed files with 1214 additions and 3 deletions

View file

@ -181,10 +181,10 @@ macro_rules! shared_ids {
}
macro_rules! linear_ids {
($ids:ident, $id:ident $(,)?) => {
linear_ids!($ids, $id, u32);
($(#[$attr1:meta])* $ids:ident, $id:ident $(,)?) => {
linear_ids!($(#[$attr1])* $ids, $id, u32);
};
($ids:ident, $id:ident, $ty:ty $(,)?) => {
($(#[$attr1:meta])* $ids:ident, $id:ident, $ty:ty $(,)?) => {
pub struct $ids {
next: crate::utils::numcell::NumCell<$ty>,
}
@ -197,6 +197,7 @@ macro_rules! linear_ids {
}
}
$(#[$attr1])*
impl $ids {
pub fn next(&self) -> $id {
$id(self.next.fetch_add(1))