Read files macro for loading reading files to string at compile-time

Makefile for formatting and linting

Workspace for subcrates.

Moved crates to subdir and moved subcrate configs to workspace.*
This commit is contained in:
Martin Berg Alstad
2024-07-14 23:59:36 +02:00
parent 7a0cf00cbc
commit 5cd1c075a5
19 changed files with 342 additions and 95 deletions

View File

@ -0,0 +1,20 @@
use proc_macro::TokenStream;
use quote::quote;
use syn::DeriveInput;
pub fn into_response_derive_impl(input: DeriveInput) -> TokenStream {
let name = &input.ident;
let expanded = quote! {
impl IntoResponse for #name {
fn into_response(self) -> Response {
let version = env!("CARGO_PKG_VERSION");
lib::serde::response::BaseResponse::new(version, self)
.into_response()
}
}
};
TokenStream::from(expanded)
}

View File

@ -0,0 +1,13 @@
extern crate proc_macro;
use {
proc_macro::TokenStream,
syn::{parse_macro_input, DeriveInput},
};
mod derive;
#[proc_macro_derive(IntoResponse)]
pub fn into_response_derive(input: TokenStream) -> TokenStream {
let input = parse_macro_input!(input as DeriveInput);
derive::into_response_derive_impl(input)
}