1
Fork 0

Remove infallible error.

This commit is contained in:
Bauke 2024-01-31 12:41:13 +01:00
parent e7a326c688
commit 8167f5b2fb
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 1 additions and 4 deletions

View File

@ -57,9 +57,6 @@ use byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt};
/// All possible errors that can happen with reading or writing messages. /// All possible errors that can happen with reading or writing messages.
#[derive(Debug, thiserror::Error)] #[derive(Debug, thiserror::Error)]
pub enum MessagingError { pub enum MessagingError {
/// Infallible errors.
#[error(transparent)]
Infallible(#[from] std::convert::Infallible),
#[error(transparent)] #[error(transparent)]
/// IO errors. /// IO errors.
Io(#[from] std::io::Error), Io(#[from] std::io::Error),
@ -80,7 +77,7 @@ where
D: for<'a> serde::Deserialize<'a>, D: for<'a> serde::Deserialize<'a>,
R: Read, R: Read,
{ {
let message_length = reader.read_u32::<NativeEndian>()?.try_into()?; let message_length = reader.read_u32::<NativeEndian>()?.into();
let message_bytes = reader.take(message_length); let message_bytes = reader.take(message_length);
serde_json::from_reader(message_bytes).map_err(Into::into) serde_json::from_reader(message_bytes).map_err(Into::into)