pub async fn mail(&mut self, req: Request) -> Result<Mailbox, TransportError> {
        trace!("Mailing request: {:?}", req);

        // First, create a mailbox using the request's id
        let mailbox = Weak::upgrade(&self.post_office)
            .ok_or_else(|| {
                TransportError::IoError(io::Error::new(
                    io::ErrorKind::NotConnected,
                    "Session's post office is no longer available",
                ))
            })?
            .lock()
            .await
            .make_mailbox(req.id, CLIENT_MAILBOX_CAPACITY);

        // Second, send the request
        self.fire(req).await?;

        // Third, return mailbox
        Ok(mailbox)
    }
/// Sends a request and returns a mailbox that can receive one or more responses, failing if
/// unable to send a request or if the session's receiving line to the remote server has
/// already been severed
Sends a request and returns a mailbox that can receive one or more responses, failing if
unable to send a request or if the session's receiving line to the remote server has
already been severed
Sends a request and returns a mailbox that can receive one or more responses failing if unable to send a request or if the session ' s receiving line to the remote server has already been severed
pub async fn mail(&mut self, req: Request) -> Result<Mailbox, TransportError> {
        trace!("Mailing request: {:?}", req);
        // First, create a mailbox using the request's id
        let mailbox = Weak::upgrade(&self.post_office)
            .ok_or_else(|| {
                TransportError::IoError(io::Error::new(
                    io::ErrorKind::NotConnected,
                    "Session's post office is no longer available",
                ))
            })?
            .lock()
            .await
            .make_mailbox(req.id, CLIENT_MAILBOX_CAPACITY);
        // Second, send the request
        self.fire(req).await?;
        // Third, return mailbox
        Ok(mailbox)
    }
pub async fn mail ( & mut self , req : Request ) -> Result < Mailbox , TransportError > { trace ! ( " " req ) ; // First, create a mailbox using the request's id let mailbox = Weak :: upgrade ( & self . post_office ) . ok_or_else ( | | { TransportError :: IoError ( io :: Error :: new ( io :: ErrorKind :: NotConnected , " " , ) ) } ) ? . lock ( ) . await . make_mailbox ( req . id , CLIENT_MAILBOX_CAPACITY ) ; // Second, send the request self . fire ( req ) . await ? ; // Third, return mailbox Ok ( mailbox ) }
Sends a request and returns a mailbox that can receive one or more responses, failing if
unable to send a request or if the session's receiving line to the remote server has
already been severed
Sends a request and returns a mailbox that can receive one or more responses failing if unable to send a request or if the session ' s receiving line to the remote server has already been severed
&mut self
req
Request