1mod pattern;
9
10use proc_macro::TokenStream;
11use proc_macro2::TokenStream as TokenStream2;
12use spdlog_internal::pattern_parser::Result;
13
14#[proc_macro]
15pub fn pattern(input: TokenStream) -> TokenStream {
16 let pattern = syn::parse_macro_input!(input);
17 into_or_error(pattern::pattern_impl(pattern))
18}
19
20#[proc_macro]
21pub fn runtime_pattern(input: TokenStream) -> TokenStream {
22 let runtime_pattern = syn::parse_macro_input!(input);
26 into_or_error(pattern::runtime_pattern_impl(runtime_pattern))
27}
28
29fn into_or_error(result: Result<TokenStream2>) -> TokenStream {
30 match result {
31 Ok(stream) => stream.into(),
32 Err(err) => panic!("{}", err),
33 }
34}