Add a viewer tool

This commit is contained in:
Olivier Goffart 2020-05-12 19:19:25 +02:00
parent f88d856990
commit 7d1394e349
4 changed files with 199 additions and 3 deletions

View file

@ -66,12 +66,12 @@ pub fn const_field_offset(input: TokenStream) -> TokenStream {
// Build the output, possibly using quasi-quotation
let expanded = quote! {
struct #field_struct_name {
#(#fields : usize,)*
pub struct #field_struct_name {
#(pub #fields : usize,)*
}
impl #struct_name {
/*pub ??? */ const fn field_offsets() -> #field_struct_name {
pub const fn field_offsets() -> #field_struct_name {
let mut len = 0usize;
#field_struct_name {
#( #fields : {