All notable changes to pasts
will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Updated documentation and examples to point to the new
0.4
version of theasync_main
crate.
- Tasks not spawning when
web
feature is enabled
- Documentation recommending wrong version of
async_main
crate
NotifyExt
trait, split off fromNotify
NotifyExt
to the preludenotify::select()
,notify::Select
notify::pending()
,notify::Pending
notify::ready()
,notify::Ready
notify::future_fn()
to match the rest of the async ecosystemnotify::poll_fn()
to match the rest of the async ecosystemnotify::Map
, returned fromNotify::map()
notify::Next
, returned fromNotify::next()
- Missing
impl Debug for BoxNotify
(was already onLocalBoxNotify
) Executor::spawn_boxed()
Executor::spawn_notify()
- Rename
Notifier
tonotify::Notify
- Rename
BoxNotifier
tonotify::BoxNotify
- Rename
LocalBoxNotifier
tonotify::LocalBoxNotify
- Rename
Poller
toPollFn
- Rename
Loop
toFutureFn
- Rename
Join
toLoop
- Unused dependency
pin_utils
Poller::new()
; usenotify::poll_fn()
insteadLoop::new()
; usenotify::future_fn()
insteadLoop::pin()
; usenotify::future_fn()
instead- Third generic for
FutureFn
Notify::map()
, useNotifyExt::map()
insteadNotify::next()
, useNotifyExt::next()
insteadSpawn
trait, useasync_main
crate instead
- Remove useless generic
B
fromNotifyExt::map()
- Bug where spawning without suspending the future while blocking the executor never executes the spawned future.
- Added
Spawn
trait for spawning bothSend
futures and local tasks. - Re-export of
Spawn
in theprelude
. Executor::block_on()
- Defaults for
T = ()
on bothBoxNotifier
andNotifier
std
feature, enabled by default
prelude::Poll
is now a type alias with generic default set to unit- Recommend using
async_main
crate in docs core::task::Context
is now re-exported asTask
instead ofExec
in preludeLocal
type alias is renamed toLocalBoxNotifier
Task
type alias is renamed toBoxNotifier
Executor
no longer executes onDrop
; must callblock_on()
instead
Sleep
, usePool
andPark
insteadno-std
feature, for no-std environments disablestd
instead
- Infinite recursion in
impl<N: Notifier, ..> Notifier for Box<N>
no-std
feature
Executor::new()
now takesimpl Into<Arc<I>>
instead ofI
Executor::spawn()
no longer requiresUnpin
futuresSleep
trait now requiresSend + Sync + 'static
- Started using
core::hint::spin_loop()
for default no-std executor
std
feature - to use pasts on no-std environments use the newno-std
feature instead
Sleep
trait for implementing custom executorsNotifier
trait (likeAsyncIterator
, but infinite)Poller
struct for compatibility with futuresFuse
trait for turningFuture
s intoNotifier
sExecutor
struct for custom executorsLoop
struct for a notifier created from future producersBox
,Future
,Pin
,Exec
(alias tocore::task::Context
),Executor
,Fuse
,Local
,Task
andNotifier
to prelude.Local
type alias for!Send
boxedNotifier
sTask
type alias forSend
boxedNotifier
s
Loop
renamed toJoin
Join::on()
now takes a closure for the notifierTask
got split into many different specialized types
poll_next_fn()
in favor of newPoller
typeblock_on()
- all futures must be spawned locally now (this change was made to support the same behavior on web assembly as other platforms)BlockOn
trait in favor of newExecutor
structExecutor
trait in favor of using newSleep
trait in combination with theWake
trait from the std library.
- More documentation
poll_next_fn()
- Completely reimplemented
Task
so it doesn't always require allocation orSend
(it should be more obvious which methods require allocation now) Loop::on()
accepts different types for the second parameter
- A
prelude
module containing acore::task::Poll::{self, Pending, Ready}
re-export Loop::on()
BlockOn
traitTask::new()
Task::poll_next()
- Replaced
Loop::when
andLoop::poll
withLoop::on()
- Move
block_on_pinned()
andblock_on
out ofExecutor
and into their ownBlockOn
trait Task
is no longer an alias, but its own type
Loop::when()
- useLoop::on()
Loop::poll()
- useLoop::on()
Loop
struct to replacewait!()
andexec!()
.Task
type definition for dynamically spawning tasks.Executor
trait for implementing custom executors on no-std.Past
struct for executing!Unpin
futures.
- Removed all unsafe!
- Executor no longer terminates program upon future completion.
- Executor now uses thread parking instead of condvars internally.
exec!()
macro - useLoop::when()
instead.join!()
macro - useLoop::poll()
instead.race!()
macro - useLoop::poll()
instead.wait!()
macro - useLoop::when()
instead.
- Executor never going to sleep, wasting CPU cycles.
- Executor freezing up and not being recoverable (happenned sometimes when two asynchronous tasks simultaneously woke the executor).
- Links in README
- Category slug.
block_on()
function to execute a future on a thread.
- Renamed
poll!()
torace!()
- Separated non-array functionality of
poll!()
into new macro: `wait!(). join!()
no longer requires the futures to be pinned, as it can pin them itself.exec!()
macro can no longer start multiple threads, but you can use it on multiple threads simultaneously.exec!()
no longer takes a future, but an asynchronous expression that gets run in an infinite loop.
prelude
module.task!()
macro.Task
type.
Task
type alias:Pin<&'a mut (dyn Future<Output = T> + Unpin)>
task!()
macro to create aTask
from an async block or function.exec!()
macro to execute futures from synchronous code, supporting parallelization when the std feature is enabled, and not on WASM.poll!()
macro to create a future that returns ready when the first of a list of futures returns ready.join!()
macro to concurrently push multiple futures to completion.
DynFuture
andDynFut
as they were unsound; you may now use thetask!()
macro for the same effect.spawn()
as it was also unsound due to the fact it made executors that did not have a'static
lifetime nor did reference counting; you may now use theexec!()
macro instead.JoinHandle
- though there are no replacements for this API, you can useexec!()
to create a thread pool withnum_cpus
to execute tasks.Join
trait - usejoin!()
macro, which can take any number of arguments rather than being limited to six.Select
trait - usepoll!()
macro, which automatically changes your futures intoTask
s. It was renamed topoll!()
because it works differently thanselect!()
seen elsewhere in the async ecosystem.SelectBoxed
- no longer needed,poll!()
works onBox
esSelectOptional
- you may now use task queues (Vec<Task>
), and remove tasks from the vec on completion.- A lot of unsafe code, and also lines of code (less than 250 instead of over 1000).
- At least two unsoundness issues.
spawn()
function to start a non-blocking task that may run on a separate thread.JoinHandle
struct that lets you.await
on the termination of a task started withspawn()
.SelectBoxed
andSelectOptional
traits to reduce boilerplate
- Now the
alloc
crate is required.
Executor
trait andCvarExec
implementation, now you should usespawn()
instead.spawn_blocking()
, now you should transition to using non-blocking system APIsDynBoxFut
, as it is now completely useless becauseDynFut
works on boxes.
DynBoxFut
which can be enabled with the new alloc feature. Useful for converting future trait objects into theDynFuture
type. Note that enabling std automatically enables the alloc feature.
- Rename
ThreadInterrupt
toCvarExec
. - Rename
Interrupt
toExecutor
. No longer requiresnew()
to be implemented, andblock_on
is now a method rather than an associated function. It is still recommended to implementnew()
, and do it as aconst fn
.wait_for()
method is renamed towait_for_event()
and is now markedunsafe
in order to guarantee soundness.interrupt
method is nowtrigger_event()
and markedunsafe
for the same reason. Anis_used()
method is now required as well. Executors must now have a static lifetime; This is in order to fix theblock_on()
bug mentioned below.
- After return of
block_on()
,Waker
s from that executor containing pointers to free'd memory, and dereferencing them on.wake()
. This unsound behavior is no longer possible withoutunsafe
code.
Join
trait now takesself
instead of&mut self
, fixes UB- Internals of
Select
no longer contain unsafe code.
.join()
allowing for moving pinned futures.
- Simplified
select!()
implementation. This also reduces the amount of bounds checking. Select
trait now requires thatFuture
s areUnpin
, this fixes a bug that allowed for pinned futures to be moved between calls to.select()
.
.select()
allowing for moving pinned futures.
Thanks to everyone who contributed to make this version of pasts possible!
Join
trait to replacejoin!()
Select
trait to replaceselect!()
DynFut
trait for convertingFuture
s intoDynFuture
s. This lets you put your futures into arrays.prelude
module for traits.
- All macros
Task
join!()
similar to macro fromfutures
crate.select!()
similar to macro fromfutures
crate.run!()
a macro that builds an asynchronous loop.task!()
a pinning macro, which unlikepin-util
'spin_mut!()
doesn't insert unsafe code.Task
- an abstraction over a pinned future, that disallows attempting to run futures after completion.ThreadInterrupt
- a condvar-based interrupt (requires std library feature to be enabled).Interrupt
- a safe way to define asynchronous waking in the executor.spawn_blocking
- liketokio
'sspawn_blocking
, creates a future from a closure by running it on a dynamically sized thread pool (also requires std library feature to be enabled).