Trait SendDescUnicast

Source
pub trait SendDescUnicast {
    // Provided method
    fn block2<IC, R, TP>(
        self,
        block2: Option<BlockInfo>,
    ) -> UnicastBlock2<Self, IC>
       where IC: InboundContext,
             R: Send,
             TP: TransParams,
             Self: SendDesc<IC, R, TP> + Sized { ... }
}
Expand description

Marker trait for identifying that this SendDesc is for unicast requests. Also contains unicast-specific combinators, such as block2().

Provided Methods§

Source

fn block2<IC, R, TP>(self, block2: Option<BlockInfo>) -> UnicastBlock2<Self, IC>
where IC: InboundContext, R: Send, TP: TransParams, Self: SendDesc<IC, R, TP> + Sized,

Returns a send descriptor that will perform Block2 processing.

Note that just adding this to your send descriptor chain alone is unlikely to do what you want. You’ve got three options:

  • Add a call to emit_successful_collected_response immediately after the call to this method. This will cause the message to be reconstructed from the blocks and returned as a value from the future from send. You can optionally add an inspect combinator to get some feedback as the message is being reconstructed from all of the individual block messages.
  • Add a call to emit_successful_response along with using send_to_stream instead of send. This will give you a Stream that will contain all of the individual block messages in the stream.
  • Add your own handler to do whatever you need to do, returning ResponseStatus::SendNext until all of the blocks have been received. This is useful if you want to avoid memory allocation.

There may be other valid combinations of combinators, depending on what you are trying to do.

Implementors§