(src: &[u8])
| 212 | } |
| 213 | |
| 214 | pub fn parse_frame_len(src: &[u8]) -> Result<usize, io::Error> { |
| 215 | let n = usize::cast_from(NetworkEndian::read_u32(src)); |
| 216 | if n > netio::MAX_FRAME_SIZE { |
| 217 | return Err(io::Error::new( |
| 218 | io::ErrorKind::InvalidData, |
| 219 | netio::FrameTooBig, |
| 220 | )); |
| 221 | } else if n < 4 { |
| 222 | return Err(io::Error::new( |
| 223 | io::ErrorKind::InvalidInput, |
| 224 | "invalid frame length", |
| 225 | )); |
| 226 | } |
| 227 | Ok(n - 4) |
| 228 | } |
| 229 | |
| 230 | /// Decodes data within pgwire messages. |
| 231 | /// |
no outgoing calls
no test coverage detected