bitwarden_error_macro/full/
attribute.rs1use darling::Error;
2use quote::quote;
3
4pub(crate) fn bitwarden_error_full(
5 input: &syn::DeriveInput,
6 type_identifier: &proc_macro2::Ident,
7 export_as_identifier: &proc_macro2::Ident,
8) -> proc_macro::TokenStream {
9 if type_identifier != export_as_identifier {
10 return Error::custom("`bitwarden_error(full)` does not currently support `export_as`")
11 .write_errors()
12 .into();
13 }
14
15 quote! {
16 #[derive(serde::Serialize)]
17 #[cfg_attr(feature = "uniffi", derive(uniffi::Error))]
18 #[cfg_attr(feature = "wasm", derive(bitwarden_error::tsify::Tsify), tsify(into_wasm_abi))]
19 #input
20 }
21 .into()
22}