aboutsummaryrefslogtreecommitdiff
path: root/rtic-sync/src
diff options
context:
space:
mode:
authorAnshul Gupta <ansg191@anshulg.com>2024-01-06 22:52:08 -0800
committerGitHub <noreply@github.com>2024-01-07 06:52:08 +0000
commitefb82b7b05785352d0003b565f15e73ca4e656a1 (patch)
tree126826474b2d8ab2d40b79b24df3d00b5b90a5c3 /rtic-sync/src
parenta6aeb865b79de201a50f8ad04fe48630664b06d8 (diff)
Changes `make_channel!` macro to accept more types (#877)
* Changes `make_channel!` macro to accept more types Changes `type` macro argument from `path` to `ty`, allowing more complex types like tuples, arrays, & pointers. See https://doc.rust-lang.org/reference/types.html#type-expressions. * Adds to `CHANGELOG.md`
Diffstat (limited to 'rtic-sync/src')
-rw-r--r--rtic-sync/src/channel.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/rtic-sync/src/channel.rs b/rtic-sync/src/channel.rs
index 89a23af..4f4f0c2 100644
--- a/rtic-sync/src/channel.rs
+++ b/rtic-sync/src/channel.rs
@@ -104,7 +104,7 @@ impl<T, const N: usize> Channel<T, N> {
/// Creates a split channel with `'static` lifetime.
#[macro_export]
macro_rules! make_channel {
- ($type:path, $size:expr) => {{
+ ($type:ty, $size:expr) => {{
static mut CHANNEL: $crate::channel::Channel<$type, $size> =
$crate::channel::Channel::new();
@@ -596,4 +596,9 @@ mod tests {
make();
make();
}
+
+ #[test]
+ fn tuple_channel() {
+ let _ = make_channel!((i32, u32), 10);
+ }
}