Skip to content

Commit 99d0986

Browse files
impl AsyncFn{,Mut,Once} for core::sync::SyncView
1 parent f5830a7 commit 99d0986

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

library/core/src/sync/sync_view.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,48 @@ where
242242
}
243243
}
244244

245+
#[unstable(feature = "exclusive_wrapper", issue = "98407")]
246+
impl<F, Args> AsyncFnOnce<Args> for SyncView<F>
247+
where
248+
F: AsyncFnOnce<Args>,
249+
Args: Tuple,
250+
{
251+
type CallOnceFuture = F::CallOnceFuture;
252+
253+
type Output = F::Output;
254+
255+
extern "rust-call" fn async_call_once(self, args: Args) -> Self::CallOnceFuture {
256+
self.into_inner().async_call_once(args)
257+
}
258+
}
259+
260+
#[unstable(feature = "exclusive_wrapper", issue = "98407")]
261+
impl<F, Args> AsyncFnMut<Args> for SyncView<F>
262+
where
263+
F: AsyncFnMut<Args>,
264+
Args: Tuple,
265+
{
266+
type CallRefFuture<'a>
267+
= F::CallRefFuture<'a>
268+
where
269+
F: 'a;
270+
271+
extern "rust-call" fn async_call_mut(&mut self, args: Args) -> Self::CallRefFuture<'_> {
272+
self.as_mut().async_call_mut(args)
273+
}
274+
}
275+
276+
#[unstable(feature = "exclusive_wrapper", issue = "98407")]
277+
impl<F, Args> AsyncFn<Args> for SyncView<F>
278+
where
279+
F: Sync + AsyncFn<Args>,
280+
Args: Tuple,
281+
{
282+
extern "rust-call" fn async_call(&self, args: Args) -> Self::CallRefFuture<'_> {
283+
self.as_ref().async_call(args)
284+
}
285+
}
286+
245287
#[unstable(feature = "exclusive_wrapper", issue = "98407")]
246288
impl<T> Future for SyncView<T>
247289
where

0 commit comments

Comments
 (0)