Fix simple ID serialisation in the WebSocket protocol ()

This commit is contained in:
Rushmore Mushambi 2023-05-02 13:17:27 +02:00 committed by GitHub
parent a31784495f
commit c3c6613e7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,21 +31,9 @@ enum Content<T> {
}
impl<T: Serialize> Response<T> {
fn json(self) -> Response<Json> {
let Response {
id,
content,
} = self;
let content = match content {
Content::Success(response) => {
Content::Success(Json::from(sql::to_value(response).unwrap()))
}
Content::Failure(failure) => Content::Failure(failure),
};
Response {
id,
content,
}
#[inline]
fn json(self) -> Json {
sql::to_value(self).unwrap().into()
}
/// Send the response to the channel