upgrade to syn 2.x
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
3b5607ecdc
commit
ca82b59c6f
11 changed files with 138 additions and 99 deletions
src/macros
|
@ -1,3 +1,18 @@
|
|||
use syn::{Expr, Lit, Meta};
|
||||
|
||||
pub(crate) fn get_named_string(args: &[Meta], name: &str) -> Option<String> {
|
||||
args.iter().find_map(|arg| {
|
||||
let value = arg.require_name_value().ok()?;
|
||||
let Expr::Lit(ref lit) = value.value else {
|
||||
return None;
|
||||
};
|
||||
let Lit::Str(ref str) = lit.lit else {
|
||||
return None;
|
||||
};
|
||||
value.path.is_ident(name).then_some(str.value())
|
||||
})
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub(crate) fn camel_to_snake_string(s: &str) -> String {
|
||||
let mut output = String::with_capacity(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue