add WebSocketEvent macro derive, bump chorus-macros to 0.3.0 (#490)
* feat: add WebSocketEvent derive, bump to 0.2.1 * change license, version of macros
This commit is contained in:
parent
0cbc88503b
commit
c7af410b2b
|
@ -15,7 +15,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chorus-macros"
|
name = "chorus-macros"
|
||||||
version = "0.1.0"
|
version = "0.2.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
[package]
|
[package]
|
||||||
name = "chorus-macros"
|
name = "chorus-macros"
|
||||||
version = "0.2.0"
|
version = "0.3.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "AGPL-3.0"
|
license = "MPL-2.0"
|
||||||
description = "Macros for the chorus crate."
|
description = "Macros for the chorus crate."
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
|
@ -6,6 +6,18 @@ use proc_macro::TokenStream;
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
use syn::{parse_macro_input, Data, DeriveInput, Field, Fields, FieldsNamed};
|
use syn::{parse_macro_input, Data, DeriveInput, Field, Fields, FieldsNamed};
|
||||||
|
|
||||||
|
#[proc_macro_derive(WebSocketEvent)]
|
||||||
|
pub fn websocket_event_macro_derive(input: TokenStream) -> TokenStream {
|
||||||
|
let ast: syn::DeriveInput = syn::parse(input).unwrap();
|
||||||
|
|
||||||
|
let name = &ast.ident;
|
||||||
|
|
||||||
|
quote! {
|
||||||
|
impl WebSocketEvent for #name {}
|
||||||
|
}
|
||||||
|
.into()
|
||||||
|
}
|
||||||
|
|
||||||
#[proc_macro_derive(Updateable)]
|
#[proc_macro_derive(Updateable)]
|
||||||
pub fn updateable_macro_derive(input: TokenStream) -> TokenStream {
|
pub fn updateable_macro_derive(input: TokenStream) -> TokenStream {
|
||||||
let ast: syn::DeriveInput = syn::parse(input).unwrap();
|
let ast: syn::DeriveInput = syn::parse(input).unwrap();
|
||||||
|
|
Loading…
Reference in New Issue