Expand description
This is a simple library providing ParenthesizedC
ZST that implements syn::parse::Parse and
thus, for example, can be used with syn::parse2() for the purpose of parsing (C)
attribute tokens
as in #[repr(C)]
outer attribute.
§Example:
extern crate syn;
extern crate outer_attribute;
extern crate parenthesized_c;
use parenthesized_c::ParenthesizedC;
use outer_attribute::different_layout::OuterAttribute;
fn main() -> syn::Result<()> {
let repr_c = syn::parse_str::<OuterAttribute>("#[repr(C)]")?;
let repr_transpartent = syn::parse_str::<OuterAttribute>("#[repr(transparent)]")?;
assert!(matches!(syn::parse2::<ParenthesizedC>(repr_c.tokens), Ok(_)));
assert!(matches!(syn::parse2::<ParenthesizedC>(repr_transpartent.tokens), Err(_)));
Ok(())
}
Structs§
- A ZST that implements syn::parse::Parse and thus, for example, can be used with syn::parse2() for the purpose of parsing
(C)
attribute tokens as in#[repr(C)]
outer attribute.