Skip to content

Tracking Issue for {Arc, Rc}::into_inner #106894

Closed
@steffahn

Description

@steffahn

Feature gates: #![feature(arc_into_inner)], #![feature(rc_into_inner)]

This is a tracking issue for the Arc::into_inner method, and (for API-consistency) also an Rc::into_inner analogue.

The function Arc::into_inner(x) serves as an atomic race-condition-free alternative to Arc::try_unwrap(x).ok(). See the ACP for more details.

Public API

// alloc::sync

impl<T> Arc<T> {
    /// Returns the inner value, if the `Arc` has exactly one strong reference.
    /// Otherwise, `None` is returned and the `Arc` is dropped.
    pub fn into_inner(this: Arc<T>) -> Option<T>;
}

and the extension to Rc

// alloc::rc

impl<T> Rc<T> {
    /// Returns the inner value, if the `Rc` has exactly one strong reference.
    /// Otherwise, `None` is returned and the `Rc` is dropped.
    pub fn into_inner(this: Rc<T>) -> Option<T>;
}

Steps / History

Unresolved Questions

  • None yet.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions