rc-new-cyclic-fallible

Crates.iorc-new-cyclic-fallible
lib.rsrc-new-cyclic-fallible
version1.0.0
created_at2025-04-03 07:23:00.940626+00
updated_at2025-04-03 07:23:00.940626+00
descriptionFallible variant of Rc::new_cyclic
homepage
repositoryhttps://github.com/multiversx/rc-new-cyclic-fallible
max_upload_size
id1617720
size40,655
Bianca Ialangi (BiancaIalangi)

documentation

https://github.com/multiversx/rc-new-cyclic-fallible/blob/main/README.md

README

rc_new_cyclic_fallible function

At least as of Rust 1.85, there is no standard way of using Rc::new_cyclic with a fallible closure, that is a closure that can fail.

UniqueRc is a promising development, but it is currently unstable.

This solution is as follows: the rc_new_cyclic_fallible function takes a closure that returns a Result, and returns a Result with the same error type itself.

Commit count: 5

cargo fmt