Skip to content

Commit

Permalink
Allow trailing commas in macros
Browse files Browse the repository at this point in the history
  • Loading branch information
imbolc committed Jul 12, 2024
1 parent b9c1923 commit 5a453de
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ edition = "2021"
license = "MIT"
name = "pg_task"
repository = "https://github.com/imbolc/pg_task"
version = "0.1.1"
version = "0.1.2"

[dependencies]
async-trait = "0.1"
Expand Down
2 changes: 1 addition & 1 deletion examples/counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mod util;
pg_task::task!(Count {
Start,
Proceed,
Finish
Finish,
});

// Also we need a enum representing all the possible tasks
Expand Down
4 changes: 2 additions & 2 deletions src/macros.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// Implements enum wrapper for a single task containing all it's steps
#[macro_export]
macro_rules! task {
($enum:ident { $($variant:ident),* }) => {
($enum:ident { $($variant:ident),* $(,)? }) => {
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub enum $enum {
$($variant($variant),)*
Expand Down Expand Up @@ -47,7 +47,7 @@ macro_rules! task {
/// The macro implements the outer enum wrapper containing all the tasks
#[macro_export]
macro_rules! scheduler {
($enum:ident { $($variant:ident),* }) => {
($enum:ident { $($variant:ident),* $(,)? }) => {
$crate::task!($enum { $($variant),* });
impl $crate::Scheduler for $enum {}
}
Expand Down

0 comments on commit 5a453de

Please sign in to comment.