Skip to main content

apply_initial_request

Function apply_initial_request 

Source
pub async fn apply_initial_request<Fut, Err>(
    recv_initial: impl FnOnce(InitialMessageType) -> Fut,
    protocol: &SharedServerProtocol,
    apply: impl FnOnce(&mut dyn ShapeDeserializer) -> Result<(), SerdeError>,
) -> Result<(), DeserializeError>
where Fut: Future<Output = Result<Option<Message>, Err>>, Err: Display,
Expand description

Applies the initial-request frame, when the protocol carries one, to the operation input being built.

apply receives a codec deserializer over the frame’s payload and reads the non-stream input members into the caller’s builder. When the protocol does not frame initial messages, or the stream starts with an ordinary event, nothing is consumed and apply is not called.

recv_initial reads the frame — pass the receiver’s try_recv_initial, e.g. |message_type| receiver.try_recv_initial(message_type). Taking a closure rather than &mut Receiver keeps this usable with generated receiver wrappers (such as the SigV4 unwrapping receiver) that expose the same method on a different type.