1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
use proc_macro::TokenStream;
use syn::{parse_macro_input, DeriveInput};

mod attr;
mod fields;
mod io;

#[proc_macro_derive(Io, attributes(endian))]
pub fn derive_io(input: TokenStream) -> TokenStream {
    io::derive(parse_macro_input!(input as DeriveInput))
        .unwrap_or_else(|err| err.to_compile_error())
        .into()
}