Closed alexmoon closed 6 months ago
I'm excited for this as I'd like to use this crate in a no-std, minimal-alloc environment. Even if precise waking isn't possible, it'd be great to have access to these combinators workout having to reinvent the wheel!
Adds
std
andalloc
features to enable support for no-std targets.Mostly this was just a matter of updating imports from
std
tocore
oralloc
as necessary along withcfg
directives to omit things like the vec implementations that require an allocator.The only real issue I ran into was that the implementations of
WakerArray
andWakerVec
required bothArc
andMutex
.Arc
is only available onalloc
andMutex
is only available onstd
. So I've added very basic no-std implementations of both which simply revert to using the parent waker directly instead of trying to do precise waking. I think it should be possible to implement precise waking in a no-std environment, but will require messing withRawWakers
and probably pinning and a fair amount of unsafe code. This does mean that on no-std targets all futures will be polled on every wake.The only other behavior difference is removing printing of the child error sources in the
Debug
impl of theAggregateError
structs. This was necessary because theError
trait is currently std only. It does have the side benefit of there now being aDebug
impl for anyAggregateError
whoseT
implsDisplay
instead of only whenT
implsError
.I updated CI to run
cargo check
on std, alloc, and core configurations. Let me know if you want CI to runcargo test
on the no-std configurations as well.