macro_rules! tx_channels {
(
$vis:vis struct $channels:ident : $id:ident {
$($body:tt)*
}
) => { ... };
({ $($rest:tt)* }) => { ... };
($($rest:tt)+) => { ... };
}Expand description
Declares the transmit channels of a CuBridge implementation.
ยงExamples
tx_channels! {
esc0 => EscCommand,
[publish_empty] 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.
By default, Tx channels skip bridge send calls when their upstream CuMsg
has no payload. Prefix a Tx declaration with [publish_empty] to keep
metadata-only sends enabled for backends that support them.