Make codec shape authority compile-time and fixed
This commit is contained in:
parent
bfe21dfb3f
commit
54cc167f81
2 changed files with 322 additions and 52 deletions
|
|
@ -499,7 +499,7 @@ impl PublishedControlFace {
|
|||
///
|
||||
/// # Errors
|
||||
/// Returns encoding or TLS I/O failures.
|
||||
pub fn send<Request: serde::Serialize>(
|
||||
pub fn send<Request: lazaret_core::records::SchemaType + serde::Serialize>(
|
||||
stream: &mut impl Write,
|
||||
request: &Request,
|
||||
) -> Result<(), ControlError> {
|
||||
|
|
@ -510,7 +510,11 @@ impl PublishedControlFace {
|
|||
///
|
||||
/// # Errors
|
||||
/// Returns framing, size, decoding, or TLS I/O failures.
|
||||
pub fn receive<Response: serde::de::DeserializeOwned + serde::Serialize>(
|
||||
pub fn receive<
|
||||
Response: lazaret_core::records::SchemaType
|
||||
+ serde::de::DeserializeOwned
|
||||
+ serde::Serialize,
|
||||
>(
|
||||
stream: &mut impl Read,
|
||||
) -> Result<Response, ControlError> {
|
||||
ControlClient::receive(stream).map_err(ControlError::from)
|
||||
|
|
@ -699,7 +703,11 @@ fn is_live_session(phase: SessionPhase) -> bool {
|
|||
)
|
||||
}
|
||||
|
||||
fn read_frame<Record: serde::de::DeserializeOwned + serde::Serialize>(
|
||||
fn read_frame<
|
||||
Record: lazaret_core::records::SchemaType
|
||||
+ serde::de::DeserializeOwned
|
||||
+ serde::Serialize,
|
||||
>(
|
||||
reader: &mut impl Read,
|
||||
maximum: usize,
|
||||
) -> Result<Record, ControlError> {
|
||||
|
|
@ -714,7 +722,7 @@ fn read_frame<Record: serde::de::DeserializeOwned + serde::Serialize>(
|
|||
decode(&bytes).map_err(Into::into)
|
||||
}
|
||||
|
||||
fn write_frame<Record: serde::Serialize>(
|
||||
fn write_frame<Record: lazaret_core::records::SchemaType + serde::Serialize>(
|
||||
writer: &mut impl Write,
|
||||
record: &Record,
|
||||
) -> Result<(), ControlError> {
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ fn send_outcome(
|
|||
|
||||
/// # Errors
|
||||
/// Refuses oversized or unencodable records and stream write failures.
|
||||
pub fn write_frame<T: Serialize>(
|
||||
pub fn write_frame<T: lazaret_core::records::SchemaType + Serialize>(
|
||||
stream: &mut UnixStream,
|
||||
record: &T,
|
||||
) -> Result<(), BootstrapWaiterError> {
|
||||
|
|
@ -388,7 +388,7 @@ pub fn write_frame<T: Serialize>(
|
|||
/// Refuses oversized, malformed, or incomplete frames and stream read failures.
|
||||
pub fn read_frame<T>(stream: &mut UnixStream) -> Result<T, BootstrapWaiterError>
|
||||
where
|
||||
T: serde::de::DeserializeOwned + Serialize,
|
||||
T: lazaret_core::records::SchemaType + serde::de::DeserializeOwned + Serialize,
|
||||
{
|
||||
read_waiter_frame(stream).map_err(failure)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue