mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 09:07:09 +08:00
29 lines
864 B
Rust
29 lines
864 B
Rust
pub(crate) mod api_error;
|
|
pub(crate) mod diesel;
|
|
mod helpers;
|
|
pub(crate) mod operation;
|
|
|
|
use proc_macro2::TokenStream;
|
|
use quote::quote;
|
|
use syn::DeriveInput;
|
|
|
|
pub(crate) use self::{
|
|
api_error::api_error_derive_inner,
|
|
diesel::{diesel_enum_attribute_inner, diesel_enum_derive_inner},
|
|
operation::operation_derive_inner,
|
|
};
|
|
|
|
pub(crate) fn debug_as_display_inner(ast: &DeriveInput) -> syn::Result<TokenStream> {
|
|
let name = &ast.ident;
|
|
let (impl_generics, ty_generics, where_clause) = ast.generics.split_for_impl();
|
|
|
|
Ok(quote! {
|
|
#[automatically_derived]
|
|
impl #impl_generics ::core::fmt::Display for #name #ty_generics #where_clause {
|
|
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::result::Result<(), ::core::fmt::Error> {
|
|
f.write_str(&format!("{:?}", self))
|
|
}
|
|
}
|
|
})
|
|
}
|