Rename lazy_cell_consume to lazy_cell_into_inner

Name this something that is less confusable with an atomic consume API for
`{Lazy,Once}Lock`.
This commit is contained in:
Trevor Gross 2024-07-11 03:16:45 -04:00
parent 8c39ac9ecc
commit ab56fe2053
2 changed files with 4 additions and 4 deletions

View File

@ -67,7 +67,7 @@ pub const fn new(f: F) -> LazyCell<T, F> {
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// #![feature(lazy_cell_consume)] /// #![feature(lazy_cell_into_inner)]
/// ///
/// use std::cell::LazyCell; /// use std::cell::LazyCell;
/// ///
@ -78,7 +78,7 @@ pub const fn new(f: F) -> LazyCell<T, F> {
/// assert_eq!(&*lazy, "HELLO, WORLD!"); /// assert_eq!(&*lazy, "HELLO, WORLD!");
/// assert_eq!(LazyCell::into_inner(lazy).ok(), Some("HELLO, WORLD!".to_string())); /// 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> { pub fn into_inner(this: Self) -> Result<T, F> {
match this.state.into_inner() { match this.state.into_inner() {
State::Init(data) => Ok(data), State::Init(data) => Ok(data),

View File

@ -107,7 +107,7 @@ pub(crate) fn preinit(value: T) -> LazyLock<T, F> {
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// #![feature(lazy_cell_consume)] /// #![feature(lazy_cell_into_inner)]
/// ///
/// use std::sync::LazyLock; /// use std::sync::LazyLock;
/// ///
@ -118,7 +118,7 @@ pub(crate) fn preinit(value: T) -> LazyLock<T, F> {
/// assert_eq!(&*lazy, "HELLO, WORLD!"); /// assert_eq!(&*lazy, "HELLO, WORLD!");
/// assert_eq!(LazyLock::into_inner(lazy).ok(), Some("HELLO, WORLD!".to_string())); /// 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> { pub fn into_inner(mut this: Self) -> Result<T, F> {
let state = this.once.state(); let state = this.once.state();
match state { match state {