mirror of
https://codeberg.org/icewind/tf-log-parser.git
synced 2026-11-30 04:40:47 +01:00
some derive cleanup
This commit is contained in:
parent
14c1fbe0d9
commit
c06e09e691
5 changed files with 58 additions and 49 deletions
|
|
@ -6,8 +6,9 @@ mod event;
|
|||
|
||||
use crate::event::Event;
|
||||
use proc_macro2::TokenStream;
|
||||
use std::fmt::Debug;
|
||||
use syn::{parse_macro_input, DeriveInput, Result};
|
||||
use quote::ToTokens;
|
||||
use std::fmt::{Debug, Display};
|
||||
use syn::{parse_macro_input, DeriveInput, Error, Result};
|
||||
|
||||
/// Derive the `Event` trait for a struct
|
||||
#[proc_macro_derive(Event, attributes(event))]
|
||||
|
|
@ -36,3 +37,7 @@ trait Derivable {
|
|||
trait DeriveParams: Sized + Debug {
|
||||
fn parse(input: &DeriveInput) -> Result<Self>;
|
||||
}
|
||||
|
||||
fn err<R, T: ToTokens, U: Display>(msg: U, span: T) -> Result<R> {
|
||||
return Err(Error::new_spanned(&span, msg));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue