Skip to content

Commit bd4158b

Browse files
avoid box
1 parent e89b51f commit bd4158b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/transport/async_channel.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,15 @@ impl<S: Service> ConnectionCommon<S::Req, S::Res> for MpscServerEndpoint<S> {
212212
}
213213

214214
impl<S: Service> ServerEndpoint<S::Req, S::Res> for MpscServerEndpoint<S> {
215-
#[allow(refining_impl_trait)]
216-
fn accept_bi(&self) -> AcceptBiFuture<S::Req, S::Res> {
217-
let stream = self.stream.clone();
218-
let wrapped = Box::pin(async move { stream.lock().await.recv().await });
219-
220-
AcceptBiFuture {
221-
wrapped,
222-
_p: PhantomData,
223-
}
215+
async fn accept_bi(&self) -> Result<(Self::SendSink, Self::RecvStream), AcceptBiError> {
216+
let (send, recv) = self
217+
.stream
218+
.lock()
219+
.await
220+
.recv()
221+
.await
222+
.ok_or_else(|| AcceptBiError::RemoteDropped)?;
223+
Ok((send, recv))
224224
}
225225

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

0 commit comments

Comments
 (0)