Lines Matching defs:OnceCell
7 pub(crate) struct OnceCell<T> {
17 // Thread A creates a `OnceCell` and shares it with
21 unsafe impl<T: Sync + Send> Sync for OnceCell<T> {}
22 unsafe impl<T: Send> Send for OnceCell<T> {}
24 impl<T: RefUnwindSafe + UnwindSafe> RefUnwindSafe for OnceCell<T> {}
25 impl<T: UnwindSafe> UnwindSafe for OnceCell<T> {}
27 impl<T> OnceCell<T> {
28 pub(crate) const fn new() -> OnceCell<T> {
29 OnceCell { state: AtomicU8::new(INCOMPLETE), value: UnsafeCell::new(None) }
32 pub(crate) const fn with_value(value: T) -> OnceCell<T> {
33 OnceCell { state: AtomicU8::new(COMPLETE), value: UnsafeCell::new(Some(value)) }
115 /// Consumes this `OnceCell`, returning the wrapped value.
173 assert_eq!(size_of::<OnceCell<bool>>(), 1 * size_of::<bool>() + size_of::<u8>());