Skip to content

Commit

Permalink
avoid box
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Jun 25, 2024
1 parent e89b51f commit bd4158b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/transport/async_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,15 @@ impl<S: Service> ConnectionCommon<S::Req, S::Res> for MpscServerEndpoint<S> {
}

impl<S: Service> ServerEndpoint<S::Req, S::Res> for MpscServerEndpoint<S> {
#[allow(refining_impl_trait)]
fn accept_bi(&self) -> AcceptBiFuture<S::Req, S::Res> {
let stream = self.stream.clone();
let wrapped = Box::pin(async move { stream.lock().await.recv().await });

AcceptBiFuture {
wrapped,
_p: PhantomData,
}
async fn accept_bi(&self) -> Result<(Self::SendSink, Self::RecvStream), AcceptBiError> {
let (send, recv) = self
.stream
.lock()
.await
.recv()
.await
.ok_or_else(|| AcceptBiError::RemoteDropped)?;
Ok((send, recv))
}

fn local_addr(&self) -> &[LocalAddr] {
Expand Down

0 comments on commit bd4158b

Please sign in to comment.