Skip to content

Releases: Voultapher/self_cell

Version 0.9.1

03 Aug 19:43
Compare
Choose a tag to compare

This release brings 2 core changes:

  • panic inside a builder function no longer causes a memory leak.

This means that the previously documented workaround using try_new and
catch_unwind has become obsolete and the relevant example has been deleted.

  • Limited support for owners with non static lifetimes. This mostly works with the exception of automatic derives, due to technical limitations (aka I can't figure out how to do it). See the documentation for details.

Bug fixes:

  • An esoteric edge case could cause UB, see bb2f502 for more details.

  • Defining your own Result could break the macro due to hygiene issues, see #16 (comment).

In addition a set of benchmarks comparing self_cell to ouroboros have been added, see the benchmarks directory.

Version 0.9.0

19 Jun 07:37
Compare
Choose a tag to compare

This release has 2 core components:

  • Revamped dependent construction. You no longer have to choose which constructor type you want. Instead you can choose between:

    • new formerly from_fn
    • try_new formerly try_from_fn
    • try_new_or_recover new

This is a breaking change, if you used from_fn and or try_from_fn all you need to do is delete the constructor type eg. #[from_fn] in the macro invocation. If you used either from or try_from you can easily replace them by also removing the constructor type and using new and try_new respectively, eg: Ast::from(body) -> Ast::new(body, |body| body.into()). See the documentation for details.

  • A new function was added fn into_owner(self) -> $Owner which lets you efficiently recover the owner.

Version 0.8.0

13 May 07:38
Compare
Choose a tag to compare

This release adds 2 new features:

  • support for mutating the dependent value with a new function: fn with_dependent_mut<Ret>(&mut self, func: impl for<'a> FnOnce(&'a $Owner, &'a mut $Dependent<'a>) -> Ret) -> Ret.

  • support for fallible construction from functions with a new constructor type try_from_fn

See the docs for details https://docs.rs/self_cell/0.8.0/self_cell/macro.self_cell.html