pub(crate) fn check_message_buffer(message: &[u8]) -> Result<(), DeserializeError> {
    if message.len() == 4 {
        // Probably a negative HTTP error code
        Err(DeserializeError::TransportError {
            // Safe to unwrap because we just checked the length
            code: i32::from_bytes(message).unwrap(),
        })
    } else if message.len() < 20 {
        Err(DeserializeError::MessageBufferTooSmall)
    } else {
        Ok(())
    }
}
/// Checks a message buffer for common errors
Checks a message buffer for common errors
Checks a message buffer for common errors
pub(crate) fn check_message_buffer(message: &[u8]) -> Result<(), DeserializeError> {
    if message.len() == 4 {
        // Probably a negative HTTP error code
        Err(DeserializeError::TransportError {
            // Safe to unwrap because we just checked the length
            code: i32::from_bytes(message).unwrap(),
        })
    } else if message.len() < 20 {
        Err(DeserializeError::MessageBufferTooSmall)
    } else {
        Ok(())
    }
}
pub ( crate ) fn check_message_buffer ( message : & [ u8 ] ) -> Result < ( ) , DeserializeError > { if message . len ( ) == 4 { // Probably a negative HTTP error code Err ( DeserializeError :: TransportError { // Safe to unwrap because we just checked the length code : i32 :: from_bytes ( message ) . unwrap ( ) , } ) } else if message . len ( ) < 20 { Err ( DeserializeError :: MessageBufferTooSmall ) } else { Ok ( ( ) ) } }
Checks a message buffer for common errors
Checks a message buffer for common errors
message
&[u8]
message
&[u8]