Crates.io | rc-new-cyclic-fallible |
lib.rs | rc-new-cyclic-fallible |
version | 1.0.0 |
created_at | 2025-04-03 07:23:00.940626+00 |
updated_at | 2025-04-03 07:23:00.940626+00 |
description | Fallible variant of Rc::new_cyclic |
homepage | |
repository | https://github.com/multiversx/rc-new-cyclic-fallible |
max_upload_size | |
id | 1617720 |
size | 40,655 |
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.