Debian Codegraph @

third_party/rust/uniffi_internal_macros/src/lib.rs

raw
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 use proc_macro::TokenStream;
6 use syn::parse_macro_input;
7
8 mod as_ref;
9 mod checksum;
10 mod ir;
11
12 /// Custom derive for uniffi_meta::Checksum
13 #[proc_macro_derive(Checksum, attributes(checksum_ignore))]
14 pub fn checksum_derive(input: TokenStream) -> TokenStream {
15 checksum::expand_derive(parse_macro_input!(input)).into()
16 }
17
18 #[proc_macro_derive(Node, attributes(node))]
19 pub fn node(input: TokenStream) -> TokenStream {
20 ir::expand_node(parse_macro_input!(input))
21 .unwrap_or_else(syn::Error::into_compile_error)
22 .into()
23 }
24
25 #[proc_macro_derive(AsRef, attributes(as_ref))]
26 pub fn expand_as_ref(input: TokenStream) -> TokenStream {
27 as_ref::expand_as_ref(parse_macro_input!(input))
28 .unwrap_or_else(syn::Error::into_compile_error)
29 .into()
30 }