fn response_to_read_index_req(&mut self, req: &Message, read_idx: u64) -> Message {
        if req.get_from() == NONE || req.get_from() == self.id {
            self.read_states.push(ReadState {
                index: read_idx,
                request_ctx: req.entries[0].get_Data().to_vec(),
            });
            return Message::default();
        }

        let mut msg = Message::default();
        msg.set_field_type(MsgReadIndexResp);
        msg.set_to(req.get_from());
        msg.set_index(read_idx);
        msg.set_entries(RepeatedField::from_vec(req.get_entries().to_vec()));
        msg
    }
// constructs a response from `req`. If `req` comes from the peer
// itself, a blank value will be returned.
constructs a response from `req`. If `req` comes from the peer
itself, a blank value will be returned.
constructs a response from ` req ` . If ` req ` comes from the peer itself a blank value will be returned .
fn response_to_read_index_req(&mut self, req: &Message, read_idx: u64) -> Message {
        if req.get_from() == NONE || req.get_from() == self.id {
            self.read_states.push(ReadState {
                index: read_idx,
                request_ctx: req.entries[0].get_Data().to_vec(),
            });
            return Message::default();
        }
        let mut msg = Message::default();
        msg.set_field_type(MsgReadIndexResp);
        msg.set_to(req.get_from());
        msg.set_index(read_idx);
        msg.set_entries(RepeatedField::from_vec(req.get_entries().to_vec()));
        msg
    }
fn response_to_read_index_req ( & mut self , req : & Message , read_idx : u64 ) -> Message { if req . get_from ( ) == NONE || req . get_from ( ) == self . id { self . read_states . push ( ReadState { index : read_idx , request_ctx : req . entries [ 0 ] . get_Data ( ) . to_vec ( ) , } ) ; return Message :: default ( ) ; } let mut msg = Message :: default ( ) ; msg . set_field_type ( MsgReadIndexResp ) ; msg . set_to ( req . get_from ( ) ) ; msg . set_index ( read_idx ) ; msg . set_entries ( RepeatedField :: from_vec ( req . get_entries ( ) . to_vec ( ) ) ) ; msg }
constructs a response from `req`.
constructs a response from ` req ` .
&mut self
req
&Message
read_idx
u64