-
Breaking changes:
BoxScope::new
now accepts aScope
object that is unsafe to construct directly. Safe use ofnolife
now requires using thescope!({})
macro. This is to fix a soundness issue that can occur when aFrozenFuture
is polled directly, without giving back control to nolife's executor. The macros ensure that a frozen future is always immediately awaited. To update your usages, replace:
let scope = BoxScope::new(|time_capsule| async { time_capsule.freeze_forever(&mut some_ref()).await });
with:
let scope = BoxScope::new(scope!({ freeze_forever!(&mut some_ref()) }));
Check the documentation of the
scope!
macro for details.- The lifetime of the
Family
type passed to the closure inBoxScope::enter
changed to fix a soundness issue. - Removed
DynBoxScope
, useBoxScope::new_dyn
instead.
-
Improvement: dynamic scope no longer boxes the future, as it is already behind a level of indirection in a
BoxScope
.
Thanks to @steffahn for opening the above issues and helping fix them ❤️
- Fix documentation links
- Add a beautifully handcrafted icon
- Add
TimeCapsule::freeze_forever
as a convenience method - Add
DynBoxScope::pin
as a convenience method.
- Add
DynBoxScope
type for common case of erased future
-
Breaking changes:
- Tightened
BoxScope::enter
signature so that the frozen reference cannot escape, fixing a soundness issue. Replace:
let frozen_ref = scope.enter(identity); use_frozen_ref(frozen_ref, refs_from_environment);
with:
scope.enter(|frozen_ref| use_frozen_ref(frozen_ref, refs_from_environment));
Note that
BoxScope::enter
signature was adjusted to allow passing references from the environment to its closure argument. If your code specifically relied on storing the escaped reference, it cannot be ported to the new version. However, it was likely unsound.- Removed
StackScope
s, hidScope
andSingleFamily
. - Removed closed scopes again 🤡. Replace:
let scope = WhateverScope::new(); let mut scope = scope.open(producer); scope.enter(consumer);
with:
let mut scope = WhateverScope::new(producer); scope.enter(consumer);
- Tightened
- Breaking change: separated closed and opened scope. Replace:
let mut scope = WhateverScope::new(...);
scope.open(...);
scope.enter(...);
with:
let scope = WhateverScope::new(...); // removed the mut
let mut scope = scope.open(...); // re-assign the scope
scope.enter(...); // unchanged
- Fix a panic that would occur when dropping an unopened scope.
- Initial version