Skip to main content

ReplySink

Trait ReplySink 

Source
pub trait ReplySink<Reply, DeliveryCx, Pipeline>: Send + Sync {
    type Error: Display;

    // Required method
    fn deliver(
        &self,
        name: &str,
        reply: &Reply,
        pipeline: &Pipeline,
        cx: &PublishContext<'_, DeliveryCx>,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
}
Expand description

The reply-wiring axis: how a handler’s reply value leaves the service.

Selected by the type the include site attaches: a TypedPublisher stack encodes the reply with its codec and runs its transforms and the scope’s publish pipeline, while a bare Publisher sends the reply’s bytes as-is (no codec, no transforms, no pipeline). One PublishingHandler serves both, so the encoded and the byte reply forms differ only in what pairs at the include site.

Required Associated Types§

Source

type Error: Display

The error surfaced when the reply cannot be published.

Required Methods§

Source

fn deliver( &self, name: &str, reply: &Reply, pipeline: &Pipeline, cx: &PublishContext<'_, DeliveryCx>, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Publishes reply to name.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<Reply, DeliveryCx, Pipeline, Bare> ReplySink<Reply, DeliveryCx, Pipeline> for Bare
where Reply: AsRef<[u8]> + Sync, DeliveryCx: Sync, Pipeline: Send + Sync, Bare: Publisher,

The byte wiring: a bare Publisher sends an AsRef<[u8]> reply unencoded.

Source§

type Error = <Bare as Publisher>::Error

Source§

impl<Reply, DeliveryCx, Pipeline, Leaf, ReplyCodec, Transforms> ReplySink<Reply, DeliveryCx, Pipeline> for TypedPublisher<Leaf, ReplyCodec, Transforms>
where Reply: Serialize + Sync, DeliveryCx: Sync, Pipeline: PublishPipeline, Leaf: Publisher, ReplyCodec: Codec, Transforms: PublishTransform<DeliveryCx>,

The encoded wiring: the reply serializes through the stack’s reply codec, then travels the stack’s transforms and the scope’s publish pipeline.

Source§

type Error = Box<dyn Error + Sync + Send>