Allow LeSer/BeSer impls missing either Serialize or Deserialize (#655)

* Allow LeSer/BeSer impls missing Serialize/Deserialize

Currently, using `LeSer` or `BeSer` requires that the type implements
both `Serialize` and `DeserializeOwned`, even if we're only using the
trait for one of those functionalities.

Moving the bounds to the methods gives the convenience of the traits
without requiring unnecessary derives.

* Remove unused #[derive(Serialize/Deserialize)]

This should hopefully reduce compile times - if only by a little bit.

Some of these were already unused (we weren't using LeSer/BeSer for the
types), but most are have *become* unused with the change to
LeSer/BeSer.
This commit is contained in:
Max Sharnoff
2021-09-24 10:06:03 -07:00
committed by GitHub
parent ff5cbe2694
commit bd9f4794d9
5 changed files with 76 additions and 33 deletions

View File

@@ -5,7 +5,7 @@ use std::{
use anyhow::bail;
use bytes::Bytes;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use zenith_utils::{
postgres_backend::{self, query_from_cstring, AuthType, PostgresBackend},
pq_proto::{BeMessage, SINGLE_COL_ROWDESC},
@@ -60,13 +60,13 @@ struct MgmtHandler {
// "Failure": "oops"
// }
// }
#[derive(Serialize, Deserialize)]
#[derive(Deserialize)]
pub struct PsqlSessionResponse {
session_id: String,
result: PsqlSessionResult,
}
#[derive(Serialize, Deserialize)]
#[derive(Deserialize)]
pub enum PsqlSessionResult {
Success(DatabaseInfo),
Failure(String),