Skip to content

Commit

Permalink
Rename lazy_cell_consume to lazy_cell_into_inner
Browse files Browse the repository at this point in the history
Name this something that is less confusable with an atomic consume API for
`{Lazy,Once}Lock`.
  • Loading branch information
tgross35 committed Jul 11, 2024
1 parent 8c39ac9 commit ab56fe2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions library/core/src/cell/lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> {
/// # Examples
///
/// ```
/// #![feature(lazy_cell_consume)]
/// #![feature(lazy_cell_into_inner)]
///
/// use std::cell::LazyCell;
///
Expand All @@ -78,7 +78,7 @@ impl<T, F: FnOnce() -> T> LazyCell<T, F> {
/// assert_eq!(&*lazy, "HELLO, WORLD!");
/// assert_eq!(LazyCell::into_inner(lazy).ok(), Some("HELLO, WORLD!".to_string()));
/// ```
#[unstable(feature = "lazy_cell_consume", issue = "125623")]
#[unstable(feature = "lazy_cell_into_inner", issue = "125623")]
pub fn into_inner(this: Self) -> Result<T, F> {
match this.state.into_inner() {
State::Init(data) => Ok(data),
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/sync/lazy_lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> {
/// # Examples
///
/// ```
/// #![feature(lazy_cell_consume)]
/// #![feature(lazy_cell_into_inner)]
///
/// use std::sync::LazyLock;
///
Expand All @@ -118,7 +118,7 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> {
/// assert_eq!(&*lazy, "HELLO, WORLD!");
/// assert_eq!(LazyLock::into_inner(lazy).ok(), Some("HELLO, WORLD!".to_string()));
/// ```
#[unstable(feature = "lazy_cell_consume", issue = "125623")]
#[unstable(feature = "lazy_cell_into_inner", issue = "125623")]
pub fn into_inner(mut this: Self) -> Result<T, F> {
let state = this.once.state();
match state {
Expand Down

0 comments on commit ab56fe2

Please sign in to comment.