pub enum BackendResponse {
Generation(BackendGenerationResponse),
GenerationStream(BackendGenerationResponse),
}
Expand description
Enum containing all types of backend responses.
Variants§
Generation(BackendGenerationResponse)
GenerationStream(BackendGenerationResponse)
Trait Implementations§
Source§impl Clone for BackendResponse
impl Clone for BackendResponse
Source§fn clone(&self) -> BackendResponse
fn clone(&self) -> BackendResponse
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'de> Deserialize<'de> for BackendResponse
impl<'de> Deserialize<'de> for BackendResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl ResponseHttpConvert<BackendRequest, BackendResponse> for BackendResponse
impl ResponseHttpConvert<BackendRequest, BackendResponse> for BackendResponse
Source§fn from_http_response<'life0, 'async_trait>(
response: ModalHttpResponse,
original_request: &'life0 BackendRequest,
) -> Pin<Box<dyn Future<Output = Result<Option<ServiceResponse<Self>>, ProtocolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn from_http_response<'life0, 'async_trait>(
response: ModalHttpResponse,
original_request: &'life0 BackendRequest,
) -> Pin<Box<dyn Future<Output = Result<Option<ServiceResponse<Self>>, ProtocolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Deserializes a
ModalHttpResponse
into ServiceResponse<Response>
.
Returns a protocol error if the response conversion fails (i.e.
response validation fails, unexpected error, etc.). A reference to the associated
request is provided, in case it’s helpful. Returns None
if the response type is unknown or unsupported
for remote host scenarios, which is synonymous with a “not found” error.Source§fn to_http_response(
response: ServiceResponse<Self>,
) -> Result<Option<ModalHttpResponse>, ProtocolError>
fn to_http_response( response: ServiceResponse<Self>, ) -> Result<Option<ModalHttpResponse>, ProtocolError>
Serializes a
Response
into a ModalHttpResponse
.
Returns None
if the response type is unsupported, which is synonymous
with a “not found” error.Source§impl ResponseJsonRpcConvert<BackendRequest, BackendResponse> for BackendResponse
impl ResponseJsonRpcConvert<BackendRequest, BackendResponse> for BackendResponse
Source§fn from_jsonrpc_message(
value: JsonRpcMessage,
original_request: &BackendRequest,
) -> Result<Option<Self>, ProtocolError>
fn from_jsonrpc_message( value: JsonRpcMessage, original_request: &BackendRequest, ) -> Result<Option<Self>, ProtocolError>
Deserializes a
JsonRpcResponse
or
JsonRpcNotification
into Response
.
Returns a protocol error if the response conversion fails (i.e.
response validation fails, unexpected error, etc.). A reference to the associated
request is provided, in case it’s helpful. Returns None
if the response type is unknown or unsupported,
which is synonymous with a “not found” error.Source§fn into_jsonrpc_message(response: BackendResponse, id: Value) -> JsonRpcMessage
fn into_jsonrpc_message(response: BackendResponse, id: Value) -> JsonRpcMessage
Serializes a
Response
into a JsonRpcResponse
or
JsonRpcNotification
.
Notifications must use the provided id
argument as the method
value.
Returns Value::Null
Auto Trait Implementations§
impl Freeze for BackendResponse
impl RefUnwindSafe for BackendResponse
impl Send for BackendResponse
impl Sync for BackendResponse
impl Unpin for BackendResponse
impl UnwindSafe for BackendResponse
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more