Closed kpreid closed 10 months ago
Also, a good no_std
version would be usable without heap allocations; however, this would require a lifetime (YieldProgress<'a>
) which would interfere with use cases involving complex async callbacks. Possibly the answer is to offer creating YieldProgress<'static>
(with internal Arc
s) for those cases, but I suspect that for flexibility, in the end we're going to lose YieldProgress
being a single type, and instead have it be parameterized over characteristics like the Sync
ness of the callbacks and the type of labels (with the ability to wrap one kind to become another to suit different crates).
YieldProgress
is, broadly, just an interface for reporting things up the (async) call stack. Therefore,no_std
compatibility is a reasonable goal. Obstacles:1
std::sync::{Arc, Mutex}
usageThe complication is that if we decide to control the use of
std::sync
via an optionalstd
frature, we would haveYieldProgress: !Send
, but (to preserve additivity of features) , we'd still have to impose aSync
bound on the provided yielder and progressor functions, which is inconvenient for users.