Lines Matching refs:unsync
3 //! `once_cell` provides two new cell-like types, [`unsync::OnceCell`] and [`sync::OnceCell`]. A `OnceCell`
19 //! The `sync` flavor is thread-safe (that is, implements the [`Sync`] trait), while the `unsync` one is not.
21 //! [`unsync::OnceCell`]: unsync/struct.OnceCell.html
82 //! There are also the [`sync::Lazy`] and [`unsync::Lazy`] convenience types to streamline this pattern:
104 //! [`unsync::Lazy`]: unsync/struct.Lazy.html
111 //! use once_cell::unsync::Lazy;
128 //! use once_cell::unsync::OnceCell;
257 //! |`unsync::OnceCell<T>` | `&T` | assignable only once |
306 //! **Should I use the sync or unsync flavor?**
308 //! Because Rust compiler checks thread safety for you, it's impossible to accidentally use `unsync` where
309 //! `sync` is required. So, use `unsync` in single-threaded code and `sync` in multi-threaded. It's easy
312 //! At the moment, `unsync` has an additional benefit that reentrant initialization causes a panic, which
354 pub mod unsync {
373 /// use once_cell::unsync::OnceCell;
390 // `&unsync::OnceCell` to sneak a `T` through `catch_unwind`,
470 /// use once_cell::unsync::OnceCell;
490 /// use once_cell::unsync::OnceCell;
511 /// use once_cell::unsync::OnceCell;
548 /// use once_cell::unsync::OnceCell;
581 /// use once_cell::unsync::OnceCell;
615 /// use once_cell::unsync::OnceCell;
631 /// use once_cell::unsync::OnceCell;
648 /// use once_cell::unsync::OnceCell;
668 /// use once_cell::unsync::Lazy;
703 /// use once_cell::unsync::Lazy;
736 /// use once_cell::unsync::Lazy;
757 /// use once_cell::unsync::Lazy;
774 /// use once_cell::unsync::Lazy;
791 /// use once_cell::unsync::Lazy;
1035 /// use once_cell::unsync::OnceCell;