pub fn parse_protocol_message<R: Message + Default>(
data: &[u8],
) -> Result<(u32, u32, R), ParseErrors>Expand description
Parse protocol message from bytes
A type parameter R (generic) is passed to try to decode the bytes into the given type.
If all went well, an Ok(Option<u32, u32, R>) is returned.
If the bytes cannot be decoded into the given type or the RpcMessageHeader’s message type of the given bytes is a RpcMessageTypes::Empty or a RpcMessageTypes::ServerReady, a Ok(None) is returned.
Also, if the RpcMessageHeader cannot be gotten from the given bytes, a Ok(None) is returned because the bytes are fully invalid.
If the RpcMessageHeader’s message type of the given bytes is a RpcMessageTypes::RemoteErrorResponse, an Err((u32, RemoteError)) is returned.