macro_rules! tx_channels {
(
$vis:vis struct $channels:ident : $id:ident {
$(
$(#[$chan_meta:meta])* $entry:tt => $payload:ty $(= $route:expr)?
),+ $(,)?
}
) => { ... };
({ $($rest:tt)* }) => { ... };
($($rest:tt)+) => { ... };
}Expand description
Declares the transmit channels of a CuBridge implementation.
ยงExamples
tx_channels! {
esc0 => EscCommand,
esc1 => EscCommand = "motor/esc1",
}tx_channels! {
pub(crate) struct MyTxChannels : MyTxId {
state => StateMsg,
}
}Channels declared through the macro gain #[repr(usize)] identifiers and an
inherent as_index() helper that returns the zero-based ordinal (matching
declaration order), which is convenient when indexing fixed arrays.