mirror of
https://github.com/hexedtech/jni-toolbox.git
synced 2024-12-23 05:44:52 +01:00
feat: option to force inline inner fn
This commit is contained in:
parent
a7c0b6881e
commit
d52677eed8
1 changed files with 4 additions and 1 deletions
|
@ -4,6 +4,7 @@ pub(crate) struct AttrsOptions {
|
|||
pub(crate) package: String,
|
||||
pub(crate) class: String,
|
||||
pub(crate) exception: Option<String>,
|
||||
pub(crate) inline: bool,
|
||||
}
|
||||
|
||||
impl AttrsOptions {
|
||||
|
@ -13,6 +14,7 @@ impl AttrsOptions {
|
|||
let mut package = None;
|
||||
let mut class = None;
|
||||
let mut exception = None;
|
||||
let mut inline = false;
|
||||
|
||||
for attr in attrs {
|
||||
match what_next {
|
||||
|
@ -23,6 +25,7 @@ impl AttrsOptions {
|
|||
"class" => what_next = WhatNext::Class,
|
||||
"exception" => what_next = WhatNext::Exception,
|
||||
"ptr" => {}, // accepted for backwards compatibility
|
||||
"inline" => inline = true,
|
||||
_ => return Err(syn::Error::new(Span::call_site(), "unexpected attribute on macro: {attr}")),
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +54,7 @@ impl AttrsOptions {
|
|||
let Some(package) = package else { return Err(syn::Error::new(Span::call_site(), "missing required attribute 'package'")) };
|
||||
let Some(class) = class else { return Err(syn::Error::new(Span::call_site(), "missing required attribute 'class'")) };
|
||||
|
||||
Ok(Self { package, class, exception })
|
||||
Ok(Self { package, class, exception, inline })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue