Move the EventHandler from the client to the proc macro

This commit is contained in:
Rodolphe Breard 2019-01-06 15:45:58 +01:00
parent 789455668c
commit 21efb88331
2 changed files with 3 additions and 3 deletions

View file

@ -13,8 +13,8 @@ pub fn event(attr: TokenStream, input: TokenStream) -> TokenStream {
let fn_body = &item.block;
let fn_output = &item.decl.output;
let output = quote! {
fn #fn_name() -> EventHandler {
EventHandler::new(#attr.to_string(), |#fn_params| #fn_output #fn_body)
fn #fn_name() -> opensmtpd::EventHandler {
opensmtpd::EventHandler::new(#attr.to_string(), |#fn_params| #fn_output #fn_body)
}
};
output.into()

View file

@ -1,6 +1,6 @@
use env_logger::{Builder, Env};
use log::{debug, info};
use opensmtpd::{event, handlers, Entry, EventHandler, SmtpIn};
use opensmtpd::{event, handlers, Entry, SmtpIn};
#[event(Any)]
fn on_event(entry: &Entry) -> bool {