Skip to main content

link

Function link 

Source
pub fn link(req: &mut Msg, rsp: &Msg) -> Option<MsgId>
Expand description

Pair a response with its request: stamps the response’s parent id and sets the request’s selected_rsp to the response id.

Returns the previous selected-response id, if any, so callers can release the now-stale response.

§Examples

use dynomite::msg::{response, Msg, MsgType};

let mut req = Msg::new(1, MsgType::ReqRedisGet, true);
let rsp = Msg::new(2, MsgType::RspRedisStatus, false);
let prev = response::link(&mut req, &rsp);
assert!(prev.is_none());
assert_eq!(req.selected_rsp(), Some(2));