Skip to main content

data_stream_dispatch

Macro data_stream_dispatch 

Source
macro_rules! data_stream_dispatch {
    (
        $enum:ident, $self:expr,
        $( [ $( $variant:ident @ $feat:literal ),+ $(,)? ] => |$s:ident, $draft:ident| $body:expr ),+ $(,)?
    ) => { ... };
}
Expand description

Expands one body per group of drafts that share a shape, over AnySubgroupWriter, AnySubgroupReader or AnyFetchReader.

Every arm is #[cfg]-gated on its own draft feature and a catch-all closes the match, so a single-draft build compiles with thirteen arms removed and a no-draft build compiles with all of them removed. The same shape moqtap_codec’s subgroup_header_accessor! generates, and for the same reason: the alternative is a hand-written arm per draft per method, of which at most five differ.

Named for data streams rather than for subgroups because a fetch stream is the other kind and reads through the same shape. Every variant it is used over therefore holds exactly one field — which is why AnyFetchReader::Draft16 wraps its stream and its resolver in a Draft16FetchStream instead of being a two-field variant.