fn send_request_vote(
        &self,
        server: usize,
        args: RequestVoteArgs,
    ) -> Receiver<Result<RequestVoteReply>> {
        info!("{}: send request vote to {}", self.me, server);
        let peer = &self.peers[server];
        let peer_clone = peer.clone();
        let (tx, rx) = channel();
        peer.spawn(async move {
            let res = peer_clone.request_vote(&args).await.map_err(Error::Rpc);
            let _ = tx.send(res);
        });
        rx
    }
/// example code to send a RequestVote RPC to a server.
/// server is the index of the target server in peers.
/// expects RPC arguments in args.
///
/// The labrpc package simulates a lossy network, in which servers
/// may be unreachable, and in which requests and replies may be lost.
/// This method sends a request and waits for a reply. If a reply arrives
/// within a timeout interval, This method returns Ok(_); otherwise
/// this method returns Err(_). Thus this method may not return for a while.
/// An Err(_) return can be caused by a dead server, a live server that
/// can't be reached, a lost request, or a lost reply.
///
/// This method is guaranteed to return (perhaps after a delay) *except* if
/// the handler function on the server side does not return.  Thus there
/// is no need to implement your own timeouts around this method.
///
/// look at the comments in ../labrpc/src/lib.rs for more details.
example code to send a RequestVote RPC to a server.
server is the index of the target server in peers.
expects RPC arguments in args.

The labrpc package simulates a lossy network, in which servers
may be unreachable, and in which requests and replies may be lost.
This method sends a request and waits for a reply. If a reply arrives
within a timeout interval, This method returns Ok(_); otherwise
this method returns Err(_). Thus this method may not return for a while.
An Err(_) return can be caused by a dead server, a live server that
can't be reached, a lost request, or a lost reply.

This method is guaranteed to return (perhaps after a delay) *except* if
the handler function on the server side does not return.  Thus there
is no need to implement your own timeouts around this method.

look at the comments in ../labrpc/src/lib.rs for more details.
example code to send a RequestVote RPC to a server . server is the index of the target server in peers . expects RPC arguments in args . The labrpc package simulates a lossy network in which servers may be unreachable and in which requests and replies may be lost . This method sends a request and waits for a reply . If a reply arrives within a timeout interval This method returns Ok ( _ ) ; otherwise this method returns Err ( _ ) . Thus this method may not return for a while . An Err ( _ ) return can be caused by a dead server a live server that can ' t be reached a lost request or a lost reply . This method is guaranteed to return ( perhaps after a delay ) * except * if the handler function on the server side does not return . Thus there is no need to implement your own timeouts around this method . look at the comments in .. / labrpc / src / lib . rs for more details .
fn send_request_vote(
        &self,
        server: usize,
        args: RequestVoteArgs,
    ) -> Receiver<Result<RequestVoteReply>> {
        info!("{}: send request vote to {}", self.me, server);
        let peer = &self.peers[server];
        let peer_clone = peer.clone();
        let (tx, rx) = channel();
        peer.spawn(async move {
            let res = peer_clone.request_vote(&args).await.map_err(Error::Rpc);
            let _ = tx.send(res);
        });
        rx
    }
fn send_request_vote ( & self , server : usize , args : RequestVoteArgs , ) -> Receiver < Result < RequestVoteReply > > { info ! ( " " self me server ) ; let peer = & self . peers [ server ] ; let peer_clone = peer . clone ( ) ; let ( tx , rx ) = channel ( ) ; peer . spawn ( async move { let res = peer_clone . request_vote ( & args ) . await . map_err ( Error :: Rpc ) ; let _ = tx . send ( res ) ; } ) ; rx }
example code to send a RequestVote RPC to a server.
example code to send a RequestVote RPC to a server .
&self
server
usize
args
RequestVoteArgs