refurb_derive/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2
3mod update;
4
5use proc_macro::TokenStream;
6use syn::{parse_macro_input, DeriveInput, Error};
7
8/// Derive an implementation of the `Update` trait for the type.
9#[proc_macro_derive(Update)]
10pub fn derive_update(input: TokenStream) -> TokenStream {
11    // Parse the input.
12    let input = parse_macro_input!(input as DeriveInput);
13
14    // Generate the token stream.
15    update::derive_update(input)
16        .unwrap_or_else(Error::into_compile_error)
17        .into()
18}