ruststream 0.7.0-rc.10

Async messaging framework for Rust: broker-agnostic traits, router, codecs, and a conformance harness for broker authors.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
//! Router mounts for the forms carrying [`Out`](crate::runtime::Out) slots, and the commits their
//! chains resolve through.
//!
//! The attachment is the reply position next to a positional slot tuple, one element per marker,
//! starting all-unbound. Each `.out(marker, policy)` binds one position and `.build()` commits;
//! the commit impls exist only for fully-bound tuples, so a forgotten binding is a compile error
//! naming the slot. A handler with a single unnamed `Out` parameter names
//! [`DefaultSlot`](crate::runtime::DefaultSlot), the implicit marker of that position.
//!
//! Like every other form, the subscription source comes from the definition - here from the one
//! the bound slots instantiate, which is why the commit resolves it rather than the entry point.
//!
//! A slot's publish pipeline is fixed here, at the registration, because binding a slot
//! instantiates the definition and the entry's pipeline is part of that instantiated type. The
//! chain therefore carries the pipeline its slots publish through: [`PublishIdentity`] on a
//! router built on its own (the app that mounts it, and the middleware it carries, exist only
//! later), the app's own on a chain a [`BrokerScope`](crate::runtime::BrokerScope) drives.

// The typed default reply needs a default codec to encode with, so those pieces are gated the
// same way; the byte-reply default publishes bare bytes and needs only `DefaultPublish`.
use crate::{
    BatchSubscriber, Broker, Connected, DefaultPublish, PublishPolicy, SubscriptionSource,
};

use crate::codec::Codec;
use crate::runtime::SourceSubscriber;
use crate::runtime::batch_inject::BatchInjectDef;
use crate::runtime::batch_publishing::BatchPublishingDef;
use crate::runtime::inject::InjectDef;
use crate::runtime::input::DecodeWith;
#[cfg(any(feature = "json", feature = "cbor", feature = "msgpack"))]
use crate::runtime::publish::ReplyWiring;
use crate::runtime::publish::{LowerOutTransforms, NarrowToUse, RawReplyWiring, SlotStackUse};
use crate::runtime::publishing::PublishingDef;
use crate::runtime::settings::{BatchSized, DefMountCodec, MountsWith};
use crate::runtime::slot::{
    BindSlots, HasSlots, InitSlots, IntoSlotSource, NoReply, OutAttachment, OutSlot, SlotCodec,
    SlotPolicy, WithSource,
};

use super::builder::Router;
use super::builders::{RouterCommit, RouterOut, RouterPublishingOut, RouterWith};
use super::mount::{
    BatchInjectMount, BatchPublishInjectMount, DefaultReply, InjectMount, MountCodec,
    PublishInjectMount, RawReplyInjectMount, RouterMount,
};
use super::{
    BatchInjectedRouter, BatchPublishingRouter, InjectedRouter, PublishingRouter, RawReplyRouter,
    forms,
};

// The five chain-producing entry points.

/// Implements [`RouterMount`] for a slot form: the chain starts with every position unbound, and
/// with the reply position present only where the handler declares a reply.
macro_rules! slot_form {
    ($($form:ty => $mount:ty, $reply:expr, $alias:ident),+ $(,)?) => {$(
        impl<B, Routes, RouteCodec, RouteLayers, RoutePipe, Def>
            RouterMount<Router<B, Routes, RouteCodec, RouteLayers, RoutePipe>, Def> for $form
        where
            B: Broker + 'static,
            Def: HasSlots,
            Def::Markers: InitSlots,
        {
            type Out = $alias<
                $mount,
                Router<B, Routes, RouteCodec, RouteLayers, RoutePipe>,
                Def,
                <Def::Markers as InitSlots>::Init,
            >;

            fn begin(
                def: Def,
                router: Router<B, Routes, RouteCodec, RouteLayers, RoutePipe>,
            ) -> Self::Out {
                RouterWith::new(def, ($reply, <Def::Markers as InitSlots>::init()), router)
            }
        }
    )+};
}

slot_form! {
    forms::Out => InjectMount, NoReply, RouterOut,
    forms::BatchOut => BatchInjectMount, NoReply, RouterOut,
    forms::PublishingOut => PublishInjectMount, DefaultReply, RouterPublishingOut,
    forms::RawReplyOut => RawReplyInjectMount, DefaultReply, RouterPublishingOut,
    forms::BatchPublishingOut => BatchPublishInjectMount, DefaultReply, RouterPublishingOut,
}

// The slot commits, one macro per form family, for fully-bound tuples only. `Bound` / `Extra`
// name the definition's `BindSlots` outputs so the bounds read flat instead of through
// `<Def::Bound as ..>` projections.

/// The pipeline one slot's `.transform(..)` steps lower onto, before its naming transform (if any)
/// takes the head of it.
type SlotPipeline<Layers, Pipe> = <Layers as LowerOutTransforms<Pipe>>::Out;

/// The live publisher one slot's policy pairs into, against the broker the route mounts on: what
/// fixes the per-message options the slot's transforms write.
type SlotLive<Policy, B> = <Policy as PublishPolicy<Connected<B>>>::Live;

/// The bound-source tuple element of one slot: the policy the runtime pairs (narrowed where the
/// chain mounted a naming transform), the codec the slot encodes with (its own when the chain
/// named one, else the surface's) and the pipeline it publishes through.
macro_rules! slot_source {
    ($attach:ident, $layers:ident, $enc:ident, $surface:ty, $pipe:ty) => {
        (
            SlotPolicy<$layers, $attach, SlotLive<$attach, B>>,
            <$enc as SlotCodec<$surface>>::Codec,
            SlotPipeline<$layers, $pipe>,
        )
    };
}

macro_rules! impl_inject_out_commit {
    ($(($($marker:ident / $attach:ident / $layers:ident / $enc:ident),+))+) => {$(
        impl<B, Routes, RouteCodec, RouteLayers, RoutePipe, Def, Bound, Extra,
             $($marker, $attach, $layers, $enc),+>
            RouterCommit<InjectMount, Router<B, Routes, RouteCodec, RouteLayers, RoutePipe>, Def>
            for (NoReply, ($(WithSource<OutAttachment<$marker, $attach, $layers, $enc>>,)+))
        where
            B: Broker + 'static,
            RouteCodec: MountCodec,
            RoutePipe: Clone,
            $(
                $marker: OutSlot,
                $enc: SlotCodec<RouteCodec::Codec, Codec: Codec>,
                $attach: PublishPolicy<Connected<B>>,
                $layers: LowerOutTransforms<RoutePipe> + SlotStackUse<SlotLive<$attach, B>>,
                <$layers as SlotStackUse<SlotLive<$attach, B>>>::Destination: NarrowToUse<$attach>,
            )+
            Def: BindSlots<
                Connected<B>,
                ($(slot_source!($attach, $layers, $enc, RouteCodec::Codec, RoutePipe),)+),
                Bound = Bound,
                Extra = Extra,
            >,
            Def: MountsWith<<Bound as InjectDef>::Input, RouteCodec>,
            Bound: InjectDef + 'static,
            Bound::Source: SubscriptionSource<Connected<B>> + Send + 'static,
            SourceSubscriber<B, Bound::Source>: Send + 'static,
            Bound::Input: DecodeWith<DefMountCodec<Def, <Bound as InjectDef>::Input, RouteCodec>>,
        {
            type Out = InjectedRouter<
                B,
                Bound::Source,
                Bound,
                DefMountCodec<Def, <Bound as InjectDef>::Input, RouteCodec>,
                Extra,
                RouteCodec,
                RouteLayers,
                RoutePipe,
                Routes,
            >;

            fn commit(
                self,
                def: Def,
                router: Router<B, Routes, RouteCodec, RouteLayers, RoutePipe>,
            ) -> Self::Out {
                #[allow(non_snake_case)]
                let (_no_reply, ($($attach,)+)) = self;
                // The slots encode with the surface's codec unless one named its own; only the
                // decode side honours the definition's `.codec(..)` override.
                let codec = router.codec.mount_codec();
                let pipeline = router.pipeline.clone();
                let decode = def.mounted_codec(&router.codec);
                let slots = [$($attach
                    .source()
                    .describe::<Connected<B>, RouteCodec::Codec>(),)+];
                let (def, extra) = def.bind(($(
                    $attach.into_source().wire(codec.clone(), pipeline.clone()),
                )+));
                let source = def.source();
                router
                    .mount_inject(source, def, decode, extra)
                    .describing_slots(&slots)
            }
        }

        impl<B, Routes, RouteCodec, RouteLayers, RoutePipe, Def, Bound, Extra,
             $($marker, $attach, $layers, $enc),+>
            RouterCommit<
                BatchInjectMount,
                Router<B, Routes, RouteCodec, RouteLayers, RoutePipe>,
                Def,
            >
            for (NoReply, ($(WithSource<OutAttachment<$marker, $attach, $layers, $enc>>,)+))
        where
            B: Broker + 'static,
            RouteCodec: MountCodec,
            RoutePipe: Clone,
            $(
                $marker: OutSlot,
                $enc: SlotCodec<RouteCodec::Codec, Codec: Codec>,
                $attach: PublishPolicy<Connected<B>>,
                $layers: LowerOutTransforms<RoutePipe> + SlotStackUse<SlotLive<$attach, B>>,
                <$layers as SlotStackUse<SlotLive<$attach, B>>>::Destination: NarrowToUse<$attach>,
            )+
            Def: BindSlots<
                Connected<B>,
                ($(slot_source!($attach, $layers, $enc, RouteCodec::Codec, RoutePipe),)+),
                Bound = Bound,
                Extra = Extra,
            >,
            Def: MountsWith<<Bound as BatchInjectDef>::Input, RouteCodec>,
            Bound: BatchInjectDef + BatchSized + 'static,
            Bound::Source: SubscriptionSource<Connected<B>> + Send + 'static,
            SourceSubscriber<B, Bound::Source>: BatchSubscriber + Send + 'static,
            Bound::Input:
                DecodeWith<DefMountCodec<Def, <Bound as BatchInjectDef>::Input, RouteCodec>>,
        {
            type Out = BatchInjectedRouter<
                B,
                Bound::Source,
                Bound,
                DefMountCodec<Def, <Bound as BatchInjectDef>::Input, RouteCodec>,
                Extra,
                RouteCodec,
                RouteLayers,
                RoutePipe,
                Routes,
            >;

            fn commit(
                self,
                def: Def,
                router: Router<B, Routes, RouteCodec, RouteLayers, RoutePipe>,
            ) -> Self::Out {
                #[allow(non_snake_case)]
                let (_no_reply, ($($attach,)+)) = self;
                // See the single-message commit: surface codec for the slots, override-aware
                // codec for the decode.
                let codec = router.codec.mount_codec();
                let pipeline = router.pipeline.clone();
                let decode = def.mounted_codec(&router.codec);
                let slots = [$($attach
                    .source()
                    .describe::<Connected<B>, RouteCodec::Codec>(),)+];
                let (def, extra) = def.bind(($(
                    $attach.into_source().wire(codec.clone(), pipeline.clone()),
                )+));
                let source = def.source();
                router
                    .mount_batch_inject(source, def, decode, extra)
                    .describing_slots(&slots)
            }
        }
    )+};
}

impl_inject_out_commit! {
    (M0 / A0 / L0 / E0)
    (M0 / A0 / L0 / E0, M1 / A1 / L1 / E1)
    (M0 / A0 / L0 / E0, M1 / A1 / L1 / E1, M2 / A2 / L2 / E2)
}

macro_rules! impl_publishing_out_commit {
    ($(($($marker:ident / $attach:ident / $layers:ident / $enc:ident),+))+) => {$(
        impl<B, Routes, RouteCodec, RouteLayers, RoutePipe, Def, Policy, Bound, Extra,
             $($marker, $attach, $layers, $enc),+>
            RouterCommit<
                PublishInjectMount,
                Router<B, Routes, RouteCodec, RouteLayers, RoutePipe>,
                Def,
            >
            for (
                WithSource<Policy>,
                ($(WithSource<OutAttachment<$marker, $attach, $layers, $enc>>,)+),
            )
        where
            B: Broker + 'static,
            RouteCodec: MountCodec,
            RoutePipe: Clone,
            $(
                $marker: OutSlot,
                $enc: SlotCodec<RouteCodec::Codec, Codec: Codec>,
                $attach: PublishPolicy<Connected<B>>,
                $layers: LowerOutTransforms<RoutePipe> + SlotStackUse<SlotLive<$attach, B>>,
                <$layers as SlotStackUse<SlotLive<$attach, B>>>::Destination: NarrowToUse<$attach>,
            )+
            Def: BindSlots<
                Connected<B>,
                ($(slot_source!($attach, $layers, $enc, RouteCodec::Codec, RoutePipe),)+),
                Bound = Bound,
                Extra = Extra,
            >,
            Def: MountsWith<<Bound as PublishingDef>::Input, RouteCodec>,
            Bound: PublishingDef + 'static,
            Bound::Source: SubscriptionSource<Connected<B>> + Send + 'static,
            SourceSubscriber<B, Bound::Source>: Send + 'static,
            Bound::Input:
                DecodeWith<DefMountCodec<Def, <Bound as PublishingDef>::Input, RouteCodec>>,
            Policy: 'static,
        {
            type Out = PublishingRouter<
                B,
                Bound::Source,
                Bound,
                DefMountCodec<Def, <Bound as PublishingDef>::Input, RouteCodec>,
                Policy,
                Extra,
                RouteCodec,
                RouteLayers,
                RoutePipe,
                Routes,
            >;

            fn commit(
                self,
                def: Def,
                router: Router<B, Routes, RouteCodec, RouteLayers, RoutePipe>,
            ) -> Self::Out {
                let (reply, slots) = self;
                #[allow(non_snake_case)]
                let ($($attach,)+) = slots;
                // Surface codec for the slots, override-aware codec for the decode.
                let codec = router.codec.mount_codec();
                let pipeline = router.pipeline.clone();
                let decode = def.mounted_codec(&router.codec);
                let slots = [$($attach
                    .source()
                    .describe::<Connected<B>, RouteCodec::Codec>(),)+];
                let (def, extra) = def.bind(($(
                    $attach.into_source().wire(codec.clone(), pipeline.clone()),
                )+));
                let source = def.source();
                router
                    .mount_publishing_source(source, def, decode, reply.into_source(), extra)
                    .describing_slots(&slots)
            }
        }

        impl<B, Routes, RouteCodec, RouteLayers, RoutePipe, Def, Policy, Bound, Extra,
             $($marker, $attach, $layers, $enc),+>
            RouterCommit<
                RawReplyInjectMount,
                Router<B, Routes, RouteCodec, RouteLayers, RoutePipe>,
                Def,
            >
            for (
                WithSource<Policy>,
                ($(WithSource<OutAttachment<$marker, $attach, $layers, $enc>>,)+),
            )
        where
            B: Broker + 'static,
            RouteCodec: MountCodec,
            RoutePipe: Clone,
            $(
                $marker: OutSlot,
                $enc: SlotCodec<RouteCodec::Codec, Codec: Codec>,
                $attach: PublishPolicy<Connected<B>>,
                $layers: LowerOutTransforms<RoutePipe> + SlotStackUse<SlotLive<$attach, B>>,
                <$layers as SlotStackUse<SlotLive<$attach, B>>>::Destination: NarrowToUse<$attach>,
            )+
            Def: BindSlots<
                Connected<B>,
                ($(slot_source!($attach, $layers, $enc, RouteCodec::Codec, RoutePipe),)+),
                Bound = Bound,
                Extra = Extra,
            >,
            Def: MountsWith<<Bound as PublishingDef>::Input, RouteCodec>,
            Bound: PublishingDef + 'static,
            Bound::Source: SubscriptionSource<Connected<B>> + Send + 'static,
            SourceSubscriber<B, Bound::Source>: Send + 'static,
            Bound::Input:
                DecodeWith<DefMountCodec<Def, <Bound as PublishingDef>::Input, RouteCodec>>,
            Policy: 'static,
        {
            type Out = RawReplyRouter<
                B,
                Bound::Source,
                Bound,
                DefMountCodec<Def, <Bound as PublishingDef>::Input, RouteCodec>,
                Policy,
                Extra,
                RouteCodec,
                RouteLayers,
                RoutePipe,
                Routes,
            >;

            fn commit(
                self,
                def: Def,
                router: Router<B, Routes, RouteCodec, RouteLayers, RoutePipe>,
            ) -> Self::Out {
                let (reply, slots) = self;
                #[allow(non_snake_case)]
                let ($($attach,)+) = slots;
                // Surface codec for the slots, override-aware codec for the decode.
                let codec = router.codec.mount_codec();
                let pipeline = router.pipeline.clone();
                let decode = def.mounted_codec(&router.codec);
                let slots = [$($attach
                    .source()
                    .describe::<Connected<B>, RouteCodec::Codec>(),)+];
                let (def, extra) = def.bind(($(
                    $attach.into_source().wire(codec.clone(), pipeline.clone()),
                )+));
                let source = def.source();
                router
                    .mount_raw_reply_source(source, def, decode, reply.into_source(), extra)
                    .describing_slots(&slots)
            }
        }

        impl<B, Routes, RouteCodec, RouteLayers, RoutePipe, Def, Policy, Bound, Extra,
             $($marker, $attach, $layers, $enc),+>
            RouterCommit<
                BatchPublishInjectMount,
                Router<B, Routes, RouteCodec, RouteLayers, RoutePipe>,
                Def,
            >
            for (
                WithSource<Policy>,
                ($(WithSource<OutAttachment<$marker, $attach, $layers, $enc>>,)+),
            )
        where
            B: Broker + 'static,
            RouteCodec: MountCodec,
            RoutePipe: Clone,
            $(
                $marker: OutSlot,
                $enc: SlotCodec<RouteCodec::Codec, Codec: Codec>,
                $attach: PublishPolicy<Connected<B>>,
                $layers: LowerOutTransforms<RoutePipe> + SlotStackUse<SlotLive<$attach, B>>,
                <$layers as SlotStackUse<SlotLive<$attach, B>>>::Destination: NarrowToUse<$attach>,
            )+
            Def: BindSlots<
                Connected<B>,
                ($(slot_source!($attach, $layers, $enc, RouteCodec::Codec, RoutePipe),)+),
                Bound = Bound,
                Extra = Extra,
            >,
            Def: MountsWith<<Bound as BatchPublishingDef>::Input, RouteCodec>,
            Bound: BatchPublishingDef + BatchSized + 'static,
            Bound::Source: SubscriptionSource<Connected<B>> + Send + 'static,
            SourceSubscriber<B, Bound::Source>: BatchSubscriber + Send + 'static,
            Bound::Input:
                DecodeWith<DefMountCodec<Def, <Bound as BatchPublishingDef>::Input, RouteCodec>>,
            Policy: 'static,
        {
            type Out = BatchPublishingRouter<
                B,
                Bound::Source,
                Bound,
                DefMountCodec<Def, <Bound as BatchPublishingDef>::Input, RouteCodec>,
                Policy,
                Extra,
                RouteCodec,
                RouteLayers,
                RoutePipe,
                Routes,
            >;

            fn commit(
                self,
                def: Def,
                router: Router<B, Routes, RouteCodec, RouteLayers, RoutePipe>,
            ) -> Self::Out {
                let (reply, slots) = self;
                #[allow(non_snake_case)]
                let ($($attach,)+) = slots;
                // Surface codec for the slots, override-aware codec for the decode.
                let codec = router.codec.mount_codec();
                let pipeline = router.pipeline.clone();
                let decode = def.mounted_codec(&router.codec);
                let slots = [$($attach
                    .source()
                    .describe::<Connected<B>, RouteCodec::Codec>(),)+];
                let (def, extra) = def.bind(($(
                    $attach.into_source().wire(codec.clone(), pipeline.clone()),
                )+));
                let source = def.source();
                router
                    .mount_batch_publishing_source(
                        source,
                        def,
                        decode,
                        reply.into_source(),
                        extra,
                    )
                    .describing_slots(&slots)
            }
        }
    )+};
}

impl_publishing_out_commit! {
    (M0 / A0 / L0 / E0)
    (M0 / A0 / L0 / E0, M1 / A1 / L1 / E1)
    (M0 / A0 / L0 / E0, M1 / A1 / L1 / E1, M2 / A2 / L2 / E2)
}

// The defaulted reply sides, committed as if `.out(Reply, ..)` had been chained with the
// broker's own policy.

#[cfg(any(feature = "json", feature = "cbor", feature = "msgpack"))]
macro_rules! impl_default_typed_reply_slot_commit {
    ($($mount:ident),+ $(,)?) => {$(
        impl<B, Routes, RouteCodec, RouteLayers, RoutePipe, Def, Slots>
            RouterCommit<$mount, Router<B, Routes, RouteCodec, RouteLayers, RoutePipe>, Def>
            for (DefaultReply, Slots)
        where
            B: Broker + 'static,
            B::Connected: DefaultPublish,
            (
                WithSource<ReplyWiring<<B::Connected as DefaultPublish>::Policy>>,
                Slots,
            ): RouterCommit<$mount, Router<B, Routes, RouteCodec, RouteLayers, RoutePipe>, Def>,
        {
            type Out = <(
                WithSource<ReplyWiring<<B::Connected as DefaultPublish>::Policy>>,
                Slots,
            ) as RouterCommit<
                $mount,
                Router<B, Routes, RouteCodec, RouteLayers, RoutePipe>,
                Def,
            >>::Out;

            fn commit(
                self,
                def: Def,
                router: Router<B, Routes, RouteCodec, RouteLayers, RoutePipe>,
            ) -> Self::Out {
                (
                    WithSource::new(ReplyWiring::new(
                        <B::Connected as DefaultPublish>::Policy::default(),
                    )),
                    self.1,
                )
                    .commit(def, router)
            }
        }
    )+};
}

#[cfg(any(feature = "json", feature = "cbor", feature = "msgpack"))]
impl_default_typed_reply_slot_commit!(PublishInjectMount, BatchPublishInjectMount);

// The serialized wire's default next to the slot tuple: the broker's plain policy taken bare,
// with no codec demand, keyed by the raw mount token.
impl<B, Routes, RouteCodec, RouteLayers, RoutePipe, Def, Slots>
    RouterCommit<RawReplyInjectMount, Router<B, Routes, RouteCodec, RouteLayers, RoutePipe>, Def>
    for (DefaultReply, Slots)
where
    B: Broker + 'static,
    B::Connected: DefaultPublish,
    (
        WithSource<RawReplyWiring<<B::Connected as DefaultPublish>::Policy>>,
        Slots,
    ): RouterCommit<
            RawReplyInjectMount,
            Router<B, Routes, RouteCodec, RouteLayers, RoutePipe>,
            Def,
        >,
{
    type Out = <(
        WithSource<RawReplyWiring<<B::Connected as DefaultPublish>::Policy>>,
        Slots,
    ) as RouterCommit<
        RawReplyInjectMount,
        Router<B, Routes, RouteCodec, RouteLayers, RoutePipe>,
        Def,
    >>::Out;

    fn commit(
        self,
        def: Def,
        router: Router<B, Routes, RouteCodec, RouteLayers, RoutePipe>,
    ) -> Self::Out {
        (
            WithSource::new(RawReplyWiring::new(
                <B::Connected as DefaultPublish>::Policy::default(),
            )),
            self.1,
        )
            .commit(def, router)
    }
}