Skip to content

Commit

Permalink
Relax constraints on JsonResponse.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamirTalwar committed Oct 10, 2023
1 parent bbf7751 commit e41f52e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rust-connector-sdk/src/json_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use http::{header, HeaderValue};
/// The value may be of a type that implements `serde::Serialize`, or it may be
/// a contiguous sequence of bytes, which are _assumed_ to be valid JSON.
#[derive(Debug, Clone)]
pub enum JsonResponse<A: serde::Serialize + (for<'de> serde::Deserialize<'de>)> {
pub enum JsonResponse<A> {
/// A value that can be serialized to JSON.
Value(A),
/// A serialized JSON bytestring that is assumed to represent a value of
Expand All @@ -16,7 +16,7 @@ pub enum JsonResponse<A: serde::Serialize + (for<'de> serde::Deserialize<'de>)>
Serialized(Bytes),
}

impl<A: serde::Serialize + (for<'de> serde::Deserialize<'de>)> JsonResponse<A> {
impl<A: (for<'de> serde::Deserialize<'de>)> JsonResponse<A> {
/// Unwraps the value, deserializing if necessary.
///
/// This is only intended for testing and compatibility. If it lives on a
Expand All @@ -33,7 +33,7 @@ impl<A: serde::Serialize + (for<'de> serde::Deserialize<'de>)> JsonResponse<A> {
}
}

impl<A: serde::Serialize + (for<'de> serde::Deserialize<'de>)> IntoResponse for JsonResponse<A> {
impl<A: serde::Serialize> IntoResponse for JsonResponse<A> {
fn into_response(self) -> axum::response::Response {
match self {
JsonResponse::Value(value) => axum::Json(value).into_response(),
Expand Down

0 comments on commit e41f52e

Please sign in to comment.