criteria: add infrastructure
This commit is contained in:
parent
597636fba6
commit
17e715cde4
18 changed files with 1214 additions and 3 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue