mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-19 06:15:45 +01:00
Move rtic macros to repo root, tune xtask
This commit is contained in:
parent
4124fbdd61
commit
9e445b3583
134 changed files with 31 additions and 29 deletions
|
|
@ -1,55 +0,0 @@
|
|||
use proc_macro2::Span;
|
||||
use syn::{parse, Field, Visibility};
|
||||
|
||||
use crate::syntax::parse::util::FilterAttrs;
|
||||
use crate::syntax::{
|
||||
ast::{LocalResource, SharedResource, SharedResourceProperties},
|
||||
parse::util,
|
||||
};
|
||||
|
||||
impl SharedResource {
|
||||
pub(crate) fn parse(item: &Field, span: Span) -> parse::Result<Self> {
|
||||
if item.vis != Visibility::Inherited {
|
||||
return Err(parse::Error::new(
|
||||
span,
|
||||
"this field must have inherited / private visibility",
|
||||
));
|
||||
}
|
||||
|
||||
let FilterAttrs {
|
||||
cfgs,
|
||||
mut attrs,
|
||||
docs,
|
||||
} = util::filter_attributes(item.attrs.clone());
|
||||
|
||||
let lock_free = util::extract_lock_free(&mut attrs)?;
|
||||
|
||||
Ok(SharedResource {
|
||||
cfgs,
|
||||
attrs,
|
||||
docs,
|
||||
ty: Box::new(item.ty.clone()),
|
||||
properties: SharedResourceProperties { lock_free },
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl LocalResource {
|
||||
pub(crate) fn parse(item: &Field, span: Span) -> parse::Result<Self> {
|
||||
if item.vis != Visibility::Inherited {
|
||||
return Err(parse::Error::new(
|
||||
span,
|
||||
"this field must have inherited / private visibility",
|
||||
));
|
||||
}
|
||||
|
||||
let FilterAttrs { cfgs, attrs, docs } = util::filter_attributes(item.attrs.clone());
|
||||
|
||||
Ok(LocalResource {
|
||||
cfgs,
|
||||
attrs,
|
||||
docs,
|
||||
ty: Box::new(item.ty.clone()),
|
||||
})
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue