1#![forbid(unsafe_code)]
2#![warn(missing_docs)]
3#![cfg_attr(
4 not(test),
5 deny(clippy::unwrap_used, clippy::expect_used, clippy::panic)
6)]
7
8extern crate proc_macro;
9use proc_macro::TokenStream;
10use stem_derive_core::impl_stem_newtype;
11use syn::{DeriveInput, parse_macro_input};
12
13#[proc_macro_derive(StemNewtype, attributes(stem))]
14pub fn derive_stem_newtype(input: TokenStream) -> TokenStream {
15 let input = parse_macro_input!(input as DeriveInput);
16 match impl_stem_newtype(&input) {
17 Ok(tokens) => tokens.into(),
18 Err(e) => e.to_compile_error().into(),
19 }
20}