MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / parse_frame_len

Function parse_frame_len

src/pgwire-common/src/codec.rs:214–228  ·  view source on GitHub ↗
(src: &[u8])

Source from the content-addressed store, hash-verified

212}
213
214pub 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///

Callers 3

decodeMethod · 0.85
decode_startupFunction · 0.85
decodeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected