Make codec shape authority compile-time and fixed

This commit is contained in:
ms2k 2026-07-19 04:33:43 +09:00
commit 54cc167f81

View file

@ -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> {