Skip to main content

parse_i64

Function parse_i64 

Source
pub fn parse_i64(s: &[u8]) -> Option<i64>
Expand description

Parses a signed decimal integer the way Redis’s string2ll does.

Returns None for anything it would reject, which includes an empty slice, a leading +, a leading zero on a non zero number, any non digit anywhere, and anything that does not fit in an i64. The protocol’s array and bulk lengths are parsed with this, so being looser here would mean accepting frames that Redis rejects, and being stricter would mean the reverse.