You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it is possible to make stack generator safe. The Co object is not Clone, therefore the only possibility to outlive the Gen is to return it from the coroutine, am I right? It is even impossible to yield it. Type system can require the coroutine return the Co object along with its return value.
pub struct Gen<'s, Y, R, F: Future> {
will be
pub struct Gen<'s, Y, R, Ret, F: Future<Output = (Co<'s, Y, R>, Ret)>> {
that Co could be returned from stack::Gen, so we force the async
producer to stack::Gen to be a return type constructed solely by
consumption of Co.
(This implements the suggestion of vlad9486 in whatisaphone#32.)
I think it is possible to make stack generator safe. The
Co
object is notClone
, therefore the only possibility to outlive theGen
is to return it from the coroutine, am I right? It is even impossible to yield it. Type system can require the coroutine return theCo
object along with its return value.will be
and
will be
The user is forced to return the
Co
, and they cannot clone it, so it will be the sameCo
, andRet
cannot contain one more.The text was updated successfully, but these errors were encountered: