Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Derive AsBindGroup Improvements: Better errors, more options, update examples #5364

Closed
14 changes: 14 additions & 0 deletions crates/bevy_macro_utils/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,17 @@ pub fn get_lit_str(attr_name: Symbol, lit: &syn::Lit) -> syn::Result<&syn::LitSt
))
}
}

pub fn get_lit_bool(attr_name: Symbol, lit: &syn::Lit) -> syn::Result<bool> {
if let syn::Lit::Bool(lit) = lit {
Ok(lit.value())
} else {
Err(syn::Error::new_spanned(
lit,
format!(
"expected {} attribute to be a bool value, `true` or `false`: `{} = ...`",
attr_name, attr_name
),
))
}
}
Loading