@@ -141,7 +141,7 @@ impl<T> OnceLock<T> {
141141
142142 /// Gets the reference to the underlying value.
143143 ///
144- /// Returns `None` if the cell is empty, or being initialized . This
144+ /// Returns `None` if the cell is empty, or being set . This
145145 /// method never blocks.
146146 #[ inline]
147147 #[ stable( feature = "once_cell" , since = "1.70.0" ) ]
@@ -168,7 +168,7 @@ impl<T> OnceLock<T> {
168168 }
169169 }
170170
171- /// Blocks the current thread until the cell is initialized .
171+ /// Blocks the current thread until the cell is set .
172172 ///
173173 /// # Example
174174 ///
@@ -198,8 +198,8 @@ impl<T> OnceLock<T> {
198198
199199 /// Sets the contents of this cell to `value`.
200200 ///
201- /// May block if another thread is currently attempting to initialize the cell. The cell is
202- /// guaranteed to contain a value when set returns, though not necessarily the one provided.
201+ /// May block if another thread is currently attempting to set the cell. The cell is
202+ /// guaranteed to contain a value when ` set` returns, though not necessarily the one provided.
203203 ///
204204 /// Returns `Ok(())` if the cell's value was set by this call.
205205 ///
@@ -233,10 +233,10 @@ impl<T> OnceLock<T> {
233233 /// Sets the contents of this cell to `value` if the cell was empty, then
234234 /// returns a reference to it.
235235 ///
236- /// May block if another thread is currently attempting to initialize the cell. The cell is
237- /// guaranteed to contain a value when set returns, though not necessarily the one provided.
236+ /// May block if another thread is currently attempting to set the cell. The cell is
237+ /// guaranteed to contain a value when ` set` returns, though not necessarily the one provided.
238238 ///
239- /// Returns `Ok(&value)` if the cell was empty and `Err(¤t_value, value)` if it was full .
239+ /// Returns `Ok(&value)` if the cell was empty and `Err(¤t_value, value)` if it was set .
240240 ///
241241 /// # Examples
242242 ///
@@ -269,19 +269,19 @@ impl<T> OnceLock<T> {
269269 }
270270 }
271271
272- /// Gets the contents of the cell, initializing it with `f` if the cell
272+ /// Gets the contents of the cell, setting it with `f` if the cell
273273 /// was empty.
274274 ///
275275 /// Many threads may call `get_or_init` concurrently with different
276- /// initializing functions, but it is guaranteed that only one function
276+ /// setting functions, but it is guaranteed that only one function
277277 /// will be executed.
278278 ///
279279 /// # Panics
280280 ///
281281 /// If `f` panics, the panic is propagated to the caller, and the cell
282- /// remains uninitialized .
282+ /// remains empty .
283283 ///
284- /// It is an error to reentrantly initialize the cell from `f`. The
284+ /// It is an error to reentrantly set the cell from `f`. The
285285 /// exact outcome is unspecified. Current implementation deadlocks, but
286286 /// this may be changed to a panic in the future.
287287 ///
@@ -307,15 +307,15 @@ impl<T> OnceLock<T> {
307307 }
308308 }
309309
310- /// Gets the mutable reference of the contents of the cell, initializing
310+ /// Gets the mutable reference of the contents of the cell, setting
311311 /// it with `f` if the cell was empty.
312312 ///
313313 /// This method never blocks.
314314 ///
315315 /// # Panics
316316 ///
317317 /// If `f` panics, the panic is propagated to the caller, and the cell
318- /// remains uninitialized .
318+ /// remains empty .
319319 ///
320320 /// # Examples
321321 ///
@@ -345,16 +345,16 @@ impl<T> OnceLock<T> {
345345 }
346346 }
347347
348- /// Gets the contents of the cell, initializing it with `f` if
348+ /// Gets the contents of the cell, setting it with `f` if
349349 /// the cell was empty. If the cell was empty and `f` failed, an
350350 /// error is returned.
351351 ///
352352 /// # Panics
353353 ///
354354 /// If `f` panics, the panic is propagated to the caller, and
355- /// the cell remains uninitialized .
355+ /// the cell remains empty .
356356 ///
357- /// It is an error to reentrantly initialize the cell from `f`.
357+ /// It is an error to reentrantly set the cell from `f`.
358358 /// The exact outcome is unspecified. Current implementation
359359 /// deadlocks, but this may be changed to a panic in the future.
360360 ///
@@ -396,7 +396,7 @@ impl<T> OnceLock<T> {
396396 Ok ( unsafe { self . get_unchecked ( ) } )
397397 }
398398
399- /// Gets the mutable reference of the contents of the cell, initializing
399+ /// Gets the mutable reference of the contents of the cell, setting
400400 /// it with `f` if the cell was empty. If the cell was empty and `f` failed,
401401 /// an error is returned.
402402 ///
@@ -405,7 +405,7 @@ impl<T> OnceLock<T> {
405405 /// # Panics
406406 ///
407407 /// If `f` panics, the panic is propagated to the caller, and
408- /// the cell remains uninitialized .
408+ /// the cell remains empty .
409409 ///
410410 /// # Examples
411411 ///
@@ -416,7 +416,7 @@ impl<T> OnceLock<T> {
416416 ///
417417 /// let mut cell: OnceLock<u32> = OnceLock::new();
418418 ///
419- /// // Failed initializers do not change the value
419+ /// // Failed sets do not change the value
420420 /// assert!(cell.get_mut_or_try_init(|| "not a number!".parse()).is_err());
421421 /// assert!(cell.get().is_none());
422422 ///
@@ -460,9 +460,9 @@ impl<T> OnceLock<T> {
460460 self . take ( )
461461 }
462462
463- /// Takes the value out of this `OnceLock`, moving it back to an uninitialized state.
463+ /// Takes the value out of this `OnceLock`, moving it back to an empty state.
464464 ///
465- /// Has no effect and returns `None` if the `OnceLock` hasn't been initialized .
465+ /// Has no effect and returns `None` if the `OnceLock` hasn't been set .
466466 ///
467467 /// Safety is guaranteed by requiring a mutable reference.
468468 ///
@@ -528,7 +528,7 @@ impl<T> OnceLock<T> {
528528
529529 /// # Safety
530530 ///
531- /// The value must be initialized
531+ /// The value must be set
532532 #[ inline]
533533 unsafe fn get_unchecked ( & self ) -> & T {
534534 debug_assert ! ( self . is_initialized( ) ) ;
@@ -537,7 +537,7 @@ impl<T> OnceLock<T> {
537537
538538 /// # Safety
539539 ///
540- /// The value must be initialized
540+ /// The value must be set
541541 #[ inline]
542542 unsafe fn get_unchecked_mut ( & mut self ) -> & mut T {
543543 debug_assert ! ( self . is_initialized( ) ) ;
0 commit comments