Make codec shape authority compile-time and fixed
This commit is contained in:
parent
bfe21dfb3f
commit
54cc167f81
1 changed files with 322 additions and 52 deletions
|
|
@ -543,7 +543,10 @@ fn lifetime_lost() -> io::Result<bool> {
|
|||
.intersects(PollFlags::IN | PollFlags::HUP | PollFlags::ERR))
|
||||
}
|
||||
|
||||
fn send_message<T: Serialize>(descriptor: impl AsFd, message: &T) -> io::Result<()> {
|
||||
fn send_message<T: lazaret_core::records::SchemaType + Serialize>(
|
||||
descriptor: impl AsFd,
|
||||
message: &T,
|
||||
) -> io::Result<()> {
|
||||
let encoded = encode(message).map_err(|error| io::Error::other(error.to_string()))?;
|
||||
if encoded.len() > MAX_CONTROL_MESSAGE {
|
||||
return Err(io::Error::other("runtime control message is oversized"));
|
||||
|
|
@ -557,7 +560,7 @@ fn send_message<T: Serialize>(descriptor: impl AsFd, message: &T) -> io::Result<
|
|||
|
||||
fn receive_message<T>(descriptor: impl AsFd) -> io::Result<T>
|
||||
where
|
||||
T: serde::de::DeserializeOwned + Serialize,
|
||||
T: lazaret_core::records::SchemaType + serde::de::DeserializeOwned + Serialize,
|
||||
{
|
||||
let mut length = [0_u8; 4];
|
||||
receive_exact(descriptor.as_fd(), &mut length)?;
|
||||
|
|
|
|||
Loading…
Reference in a new issue