Closed
Description
Introduce traits:
pub trait DerefAsync {
type Target: Deref<Target::T>;
async fn derefAsync(&self) -> Async<T>;
}
impl Deref for T: DerefAsync<Target::TOut> + TOut: Deref<Target :: TOut1>
{
type Target : Async<TOut1>
fn deref(&self) {
self.derefAsync().AndAlso(move |t| t.deref());
}
}
Add support for awaiting derefs. This can be very useful, EG, in async realization of lazy pattern:
let y = 5;
let lazy = async_lazy!(y, async |a| await!(a + 2));
let x : i32 = await!(lazy);