Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make init macros accept expr for $size, path for $mode #42

Merged
merged 2 commits into from
Nov 22, 2023

Conversation

eZioPan
Copy link
Contributor

@eZioPan eZioPan commented Nov 21, 2023

Currently, rtt_init_print!() macro didn't really use rtt_target::ChannelMode enums. Users can be confused of the rtt_init_print!(BlockIfFull, 1024) syntax, that user won't able use rtt_init_print!(ChannelMode::BlockIfFull, 1024), and when they import rtt_target::ChannelMode::*, compiler said it's a unused import.
So, this PR make init macros accept $mode:path, which let user use rtt_init_print!(ChannelMode::BlockIfFull, 1024) etc.
Also, this PR make $size:expr, which let users write rtt_init_print!(ChannelMode::BlockIfFull, 2usize.pow(10)).

And this PR is a breaking change, which require users add comma , at the end of each line of each channel of rtt_init!() macro (which make the syntax more like creating a regular struct).

@eZioPan eZioPan marked this pull request as ready for review November 21, 2023 10:01
Copy link
Member

@Yatekii Yatekii left a comment

Choose a reason for hiding this comment

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

Very nice change, thank you!

Co-authored-by: Noah Hüsser <noah@huesser.dev>
@Yatekii Yatekii added this pull request to the merge queue Nov 22, 2023
Merged via the queue into probe-rs:master with commit 422f12c Nov 22, 2023
@eZioPan eZioPan deleted the init-macros branch November 25, 2023 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants