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`
This commit is contained in:
Anshul Gupta 2024-01-06 22:52:08 -08:00 committed by GitHub
parent a6aeb865b7
commit efb82b7b05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -13,6 +13,8 @@ For each category, _Added_, _Changed_, _Fixed_ add new entries at the top!
### Fixed ### Fixed
- `make_channel` now accepts `Type` expressions instead of only `TypePath` expressions.
## v1.1.1 - 2023-12-04 ## v1.1.1 - 2023-12-04
### Fixed ### Fixed

View file

@ -104,7 +104,7 @@ impl<T, const N: usize> Channel<T, N> {
/// Creates a split channel with `'static` lifetime. /// Creates a split channel with `'static` lifetime.
#[macro_export] #[macro_export]
macro_rules! make_channel { macro_rules! make_channel {
($type:path, $size:expr) => {{ ($type:ty, $size:expr) => {{
static mut CHANNEL: $crate::channel::Channel<$type, $size> = static mut CHANNEL: $crate::channel::Channel<$type, $size> =
$crate::channel::Channel::new(); $crate::channel::Channel::new();
@ -596,4 +596,9 @@ mod tests {
make(); make();
make(); make();
} }
#[test]
fn tuple_channel() {
let _ = make_channel!((i32, u32), 10);
}
} }