pub fn memcache_parse_rsp(r: &mut Msg, input: &[u8]) -> MsgParseResultExpand description
Parse a Memcached response from input and update r in place.
On success the response type is recorded and the parser cursor advances just past the trailing LF. The function never panics on any byte sequence.
ยงExamples
use dynomite::msg::{Msg, MsgParseResult, MsgType};
use dynomite::proto::memcache::memcache_parse_rsp;
let mut r = Msg::new(0, MsgType::Unknown, false);
let res = memcache_parse_rsp(&mut r, b"STORED\r\n");
assert_eq!(res, MsgParseResult::Ok);
assert_eq!(r.ty(), MsgType::RspMcStored);The state machine intentionally lives in a single function to match the reference engine.