Lines Matching defs:SetOnce
13 /// Once the a [`SetOnce`] is populated, it remains populated by the same object for the
29 /// # use kernel::sync::SetOnce;
30 /// let value = SetOnce::new();
43 pub struct SetOnce<T> {
48 impl<T> Default for SetOnce<T> {
54 impl<T> SetOnce<T> {
55 /// Create a new [`SetOnce`].
68 /// Returns [`None`] if this [`SetOnce`] is empty.
79 /// Populate the [`SetOnce`].
81 /// Returns `true` if the [`SetOnce`] was successfully populated.
106 /// Returns [`None`] if the [`SetOnce`] is empty.
115 impl<T> Drop for SetOnce<T> {
127 // SAFETY: `SetOnce` can be transferred across thread boundaries iff the data it contains can.
128 unsafe impl<T: Send> Send for SetOnce<T> {}
130 // SAFETY: `SetOnce` synchronises access to the inner value via atomic operations,
133 unsafe impl<T: Send + Sync> Sync for SetOnce<T> {}