#[cfg(not(any(feature = "same_layout", feature = "different_layout")))]
compile_error!("At least one of the features \"same_layout\" or \"different_layout\" must be enabled for this crate.");
#[cfg(all(feature = "same_layout", feature = "different_layout"))]
compile_error!("Exactly one of the features \"same_layout\" or \"different_layout\" must be enabled for this crate.");
#[cfg(any(doc, feature = "different_layout"))]
pub mod different_layout {
pub struct OuterAttribute {
pub pound_token: syn::Token![#],
pub bracket_token: syn::token::Bracket,
pub path: syn::Path,
pub tokens: proc_macro2::TokenStream,
}
impl syn::parse::Parse for OuterAttribute {
fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> {
let content;
Ok(OuterAttribute {
pound_token: input.parse()?,
bracket_token: syn::bracketed!(content in input),
path: content.parse()?,
tokens: content.parse()?,
})
}
}
}
#[cfg(any(doc, feature = "same_layout"))]
pub mod same_layout {
pub struct OuterAttribute(pub syn::Attribute);
fn single_parse_outer(input: syn::parse::ParseStream) -> syn::Result<syn::Attribute> {
let content;
Ok(syn::Attribute {
pound_token: input.parse()?,
style: syn::AttrStyle::Outer,
bracket_token: syn::bracketed!(content in input),
path: content.call(syn::Path::parse_mod_style)?,
tokens: content.parse()?,
})
}
impl syn::parse::Parse for OuterAttribute {
fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> {
Ok(OuterAttribute(
input.call::<syn::Attribute>(single_parse_outer)?,
))
}
}
}