Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions core/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,17 @@
/// Can be used to create a `HashMap`.
#[macro_export]
macro_rules! map {
($( $name:expr => $value:expr ),*) => (
($( $name:expr => $value:expr ),* ,) => (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can use $(,)? to handle optional trailing comma

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I forget the syntax.

map!($($name => $value),*)
);

($( $name:expr => $value:expr ),* ) => (
vec![ $( ( $name, $value ) ),* ].into_iter().collect()
)
);
Comment thread
yjhmelody marked this conversation as resolved.
Outdated
}



use rstd::prelude::*;
use rstd::ops::Deref;
#[cfg(feature = "std")]
Expand Down