Skip to main content

OutSlot

Derive Macro OutSlot 

Source
#[derive(OutSlot)]
{
    // Attributes available to this derive:
    #[publishes]
}
Expand description

Derives OutSlot for a unit struct, making it a slot marker for Out<impl Publisher, Marker> handler parameters. The marker’s NAME is the struct’s identifier, used by startup errors and test assertions.

The optional #[publishes(Type, ..)] attribute lists the message types the slot may publish, which is what the generated document reports for a handler leaving its Out parameter unrestricted. The list is enforced, not only documented: publishing a type it does not name is a compile error (see PublishedThrough in the core crate), so the document cannot fall behind what handlers send. Each listed type declares its own destination with #[derive(Outgoing)]; listing one type twice is an error.

ⓘ
#[derive(OutSlot)]
struct Encoded;

#[derive(OutSlot)]
#[publishes(ChunkDone, Progress)]
struct Events;

#[subscriber("chunks")]
async fn transcode(chunk: &[u8], Out(out): Out<impl Publisher, Encoded>) -> HandlerOutcome {
    /* ... */
}
// include site: b.include(transcode).out(Encoded, KafkaPublish::default());