DeserializeResponse

Trait DeserializeResponse 

Source
pub trait DeserializeResponse:
    Send
    + Sync
    + Debug {
    // Provided methods
    fn deserialize_streaming(
        &self,
        response: &mut HttpResponse,
    ) -> Option<Result<Output, OrchestratorError<Error>>> { ... }
    fn deserialize_streaming_with_config(
        &self,
        response: &mut HttpResponse,
        _cfg: &ConfigBag,
    ) -> Option<Result<Output, OrchestratorError<Error>>> { ... }
    fn deserialize_nonstreaming(
        &self,
        response: &HttpResponse,
    ) -> Result<Output, OrchestratorError<Error>> { ... }
    fn deserialize_nonstreaming_with_config(
        &self,
        response: &HttpResponse,
        _cfg: &ConfigBag,
    ) -> Result<Output, OrchestratorError<Error>> { ... }
}
Available on crate feature client only.
Expand description

Deserialization implementation that converts an HttpResponse into an Output or Error.

This trait uses a backward-compatible versioning pattern for methods that need access to [ConfigBag]. Each method has a _with_config variant:

  • Legacy implementations override the original method (without config). The default _with_config variant delegates to it, ignoring the config.
  • New implementations override the _with_config variant. The default original method delegates to it with an empty config bag.

The orchestrator always calls the _with_config variants.

Provided Methods§

Source

fn deserialize_streaming( &self, response: &mut HttpResponse, ) -> Option<Result<Output, OrchestratorError<Error>>>

👎Deprecated: Implement deserialize_streaming_with_config instead. This method will be removed in a future release.

For streaming requests, deserializes the response headers.

The orchestrator will call deserialize_streaming_with_config first, and if it returns None, then it will continue onto deserialize_nonstreaming_with_config.

Override this or deserialize_streaming_with_config, but not both.

Source

fn deserialize_streaming_with_config( &self, response: &mut HttpResponse, _cfg: &ConfigBag, ) -> Option<Result<Output, OrchestratorError<Error>>>

For streaming requests, deserializes the response headers with access to the config bag.

This is the method called by the orchestrator. The default implementation delegates to deserialize_streaming, ignoring the config.

Source

fn deserialize_nonstreaming( &self, response: &HttpResponse, ) -> Result<Output, OrchestratorError<Error>>

👎Deprecated: Implement deserialize_nonstreaming_with_config instead. This method will be removed in a future release.

Deserialize the entire response including its body into an output or error.

Override this or deserialize_nonstreaming_with_config, but not both.

Source

fn deserialize_nonstreaming_with_config( &self, response: &HttpResponse, _cfg: &ConfigBag, ) -> Result<Output, OrchestratorError<Error>>

Deserialize the entire response including its body into an output or error, with access to the config bag.

This is the method called by the orchestrator. The default implementation delegates to deserialize_nonstreaming, ignoring the config bag.

Implementors§