httparse

Function parse_chunk_size

source
pub fn parse_chunk_size(
    buf: &[u8],
) -> Result<Status<(usize, u64)>, InvalidChunkSize>
Expand description

Parse a buffer of bytes as a chunk size.

The return value, if complete and successful, includes the index of the buffer that parsing stopped at, and the size of the following chunk.

ยงExample

let buf = b"4\r\nRust\r\n0\r\n\r\n";
assert_eq!(httparse::parse_chunk_size(buf),
           Ok(httparse::Status::Complete((3, 4))));