macro_rules! bind_wire_self_codec {
($wire:ty : $($payload:ty),+ $(,)?) => { ... };
}Expand description
Binds payload types to a wire whose marker is its own codec
(Codec = Self), removing the most repetitive line of an all-in-one
wire implementation.
// One wire identity, two payload types, marker as codec for both:
bind_wire_self_codec!(MyWire: A, B);Why not a trait default or a blanket impl? type Codec = Self; as an
associated-type default is unstable Rust, and a blanket
impl<W, T> UWirePayload<T> for W would forbid, by coherence, exactly the
wire that binds a different codec for some payload type — the case the
three-trait split exists to support. The macro adds the convenience without
closing that door.