Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed LateInit recipe stack overflow #212

Merged
merged 2 commits into from Dec 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/lib.rs
Expand Up @@ -208,7 +208,6 @@
//! ```
//! use once_cell::sync::OnceCell;
//!
//! #[derive(Debug)]
//! pub struct LateInit<T> { cell: OnceCell<T> }
//!
//! impl<T> LateInit<T> {
Expand All @@ -228,22 +227,24 @@
//! }
//! }
//!
//! #[derive(Default, Debug)]
//! #[derive(Default)]
//! struct A<'a> {
//! b: LateInit<&'a B<'a>>,
//! }
//!
//! #[derive(Default, Debug)]
//! #[derive(Default)]
//! struct B<'a> {
//! a: LateInit<&'a A<'a>>
//! }
//!
//!
//! fn build_cycle() {
//! let a = A::default();
//! let b = B::default();
//! a.b.init(&b);
//! b.a.init(&a);
//! println!("{:?}", a.b.a.b.a);
//!
//! let _a = &a.b.a.b.a;
//! }
//! ```
//!
Expand Down Expand Up @@ -314,9 +315,9 @@
//! **Does this crate support async?**
//!
//! No, but you can use [`async_once_cell`](https://crates.io/crates/async_once_cell) instead.
//!
//!
//! **Can I bring my own mutex?**
//!
//!
//! There is [generic_once_cell](https://crates.io/crates/generic_once_cell) to allow just that.
//!
//! # Related crates
Expand Down