MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / parse_integer

Function parse_integer

nodedb/src/control/server/resp/codec.rs:245–257  ·  view source on GitHub ↗
(buf: &[u8])

Source from the content-addressed store, hash-verified

243}
244
245fn parse_integer(buf: &[u8]) -> io::Result<Option<(i64, usize)>> {
246 match find_crlf(buf) {
247 Some(pos) => {
248 let s = std::str::from_utf8(&buf[..pos])
249 .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
250 let n: i64 = s
251 .parse()
252 .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
253 Ok(Some((n, pos + 2)))
254 }
255 None => Ok(None),
256 }
257}
258
259fn parse_bulk_string(buf: &[u8]) -> io::Result<Option<(RespValue, usize)>> {
260 let crlf_pos = match find_crlf(buf) {

Callers 1

parse_valueFunction · 0.85

Calls 2

find_crlfFunction · 0.85
parseMethod · 0.45

Tested by

no test coverage detected