Skip to content

Commit

Permalink
Add docstsring support for impl_events macro
Browse files Browse the repository at this point in the history
  • Loading branch information
touilleMan committed Jun 18, 2024
1 parent 3af99ca commit 6ec4c81
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions libparsec/crates/client/src/event_bus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,30 +126,30 @@ macro_rules! impl_events {
};

// e.g. Foo
(@munch ( $event:ident, $($tail:tt)* ) -> ($($output:tt)*)) => {
(@munch ( $(#[$event_attr:meta])* $event:ident, $($tail:tt)* ) -> ($($output:tt)*)) => {
paste!{
#[derive(Debug, Clone)]
pub struct [< Event $event >];
$(#[$event_attr])* pub struct [< Event $event >];
impl_broadcastable!($event, [< Event $event >], [< on_ $event:lower _cbs >]);
impl_events!(@munch ($($tail)*) -> ($($output)* [$event, [< Event $event >], [< on_ $event:lower _cbs >]]));
}
};

// e.g. Foo(u64)
(@munch ( $event:ident ( $($ty:ty),* $(,)? ), $($tail:tt)* ) -> ($($output:tt)*)) => {
(@munch ( $(#[$event_attr:meta])* $event:ident ( $($ty:ty),* $(,)? ), $($tail:tt)* ) -> ($($output:tt)*)) => {
paste!{
#[derive(Debug, Clone)]
pub struct [< Event $event>]( $(pub $ty),* );
$(#[$event_attr])* pub struct [< Event $event>]( $(pub $ty),* );
impl_broadcastable!($event, [< Event $event >], [< on_ $event:lower _cbs >]);
impl_events!(@munch ($($tail)*) -> ($($output)* [$event, [< Event $event >], [< on_ $event:lower _cbs >]]));
}
};

// e.g. Foo{ bar: u64 }
(@munch ( $event:ident { $($id:ident: $ty:ty),* $(,)? }, $($tail:tt)* ) -> ($($output:tt)*)) => {
(@munch ( $(#[$event_attr:meta])* $event:ident { $($id:ident: $ty:ty),* $(,)? }, $($tail:tt)* ) -> ($($output:tt)*)) => {
paste!{
#[derive(Debug, Clone)]
pub struct [< Event $event>] {
$(#[$event_attr])* pub struct [< Event $event>] {
$(pub $id:$ty),*
}
impl_broadcastable!($event, [< Event $event >], [< on_ $event:lower _cbs >]);
Expand Down

0 comments on commit 6ec4c81

Please sign in to comment.