Fix proc macro
This commit is contained in:
parent
29141e5b9a
commit
ca4a040d20
3 changed files with 12 additions and 7 deletions
|
@ -176,7 +176,7 @@ impl Archetype {
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if one of the queries could not be fullfilled
|
// check if one of the queries could not be fullfilled
|
||||||
for queryable_entities in complying_entities {
|
for queryable_entities in complying_entities.iter() {
|
||||||
if queryable_entities.is_empty() {
|
if queryable_entities.is_empty() {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
@ -292,4 +292,4 @@ impl_update_filter!(Nonuple, [R, r], [S, s], [T, t], [U, u], [V, v], [W, w],
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
impl_update_filter!(Decuple, [R, r], [S, s], [T, t], [U, u], [V, v], [W, w], [X, x], [Y, y], [Z, z], [A, a]);
|
impl_update_filter!(Decuple, [R, r], [S, s], [T, t], [U, u], [V, v], [W, w], [X, x], [Y, y], [Z, z], [A, a]);
|
||||||
|
|
||||||
implement_updates!(8);
|
implement_updates!(5, 5);
|
||||||
|
|
|
@ -17,13 +17,19 @@ use syn::{
|
||||||
|
|
||||||
struct UpdateInfo {
|
struct UpdateInfo {
|
||||||
max_components: usize,
|
max_components: usize,
|
||||||
|
max_resources: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Parse for UpdateInfo {
|
impl Parse for UpdateInfo {
|
||||||
fn parse(input: ParseStream) -> Result<Self> {
|
fn parse(input: ParseStream) -> Result<Self> {
|
||||||
let max_components = input.parse::<LitInt>()?.base10_parse()?;
|
let max_components = input.parse::<LitInt>()?.base10_parse()?;
|
||||||
|
input.parse::<Comma>()?;
|
||||||
|
let max_resources = input.parse::<LitInt>()?.base10_parse()?;
|
||||||
|
|
||||||
Ok(Self { max_components })
|
Ok(Self {
|
||||||
|
max_components,
|
||||||
|
max_resources,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +37,7 @@ impl Parse for UpdateInfo {
|
||||||
pub fn implement_updates(input: TokenStream) -> TokenStream {
|
pub fn implement_updates(input: TokenStream) -> TokenStream {
|
||||||
let input = parse_macro_input!(input as UpdateInfo);
|
let input = parse_macro_input!(input as UpdateInfo);
|
||||||
|
|
||||||
update(input.max_components)
|
update(input.max_components, input.max_resources)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct InputInfo {
|
struct InputInfo {
|
||||||
|
|
|
@ -153,7 +153,6 @@ struct Update {
|
||||||
|
|
||||||
impl Update {
|
impl Update {
|
||||||
const MIN_RESOURCE: usize = 0;
|
const MIN_RESOURCE: usize = 0;
|
||||||
const MAX_RESOURCE: usize = 10;
|
|
||||||
const MIN_COMPONENTS: usize = 1;
|
const MIN_COMPONENTS: usize = 1;
|
||||||
|
|
||||||
pub fn new(queries: impl Iterator<Item = usize>, resources: usize) -> Self {
|
pub fn new(queries: impl Iterator<Item = usize>, resources: usize) -> Self {
|
||||||
|
@ -454,7 +453,7 @@ impl ToTokens for Update {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update(max_components: usize) -> TokenStream {
|
pub fn update(max_components: usize, max_resources: usize) -> TokenStream {
|
||||||
let mut queries: Vec<Vec<usize>> = Vec::new();
|
let mut queries: Vec<Vec<usize>> = Vec::new();
|
||||||
|
|
||||||
for c in Update::MIN_COMPONENTS..=max_components {
|
for c in Update::MIN_COMPONENTS..=max_components {
|
||||||
|
@ -477,7 +476,7 @@ pub fn update(max_components: usize) -> TokenStream {
|
||||||
|
|
||||||
let mut resources = Vec::new();
|
let mut resources = Vec::new();
|
||||||
|
|
||||||
for resource in Update::MIN_RESOURCE..Update::MAX_RESOURCE {
|
for resource in Update::MIN_RESOURCE..=max_resources {
|
||||||
resources.push(resource);
|
resources.push(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue