Skip to content

Tracking Issue for bound_copied #145966

@connortsui20

Description

@connortsui20

Feature gate: #![feature(bound_copied)]

This is a tracking issue to add a Bound::copied method.

Public API

impl<T: Copy> Bound<&T> {
    /// Map a `Bound<&T>` to a `Bound<T>` by copying the contents of the bound.
    ///
    /// # Examples
    ///
    /// ```
    /// use std::ops::Bound::*;
    /// use std::ops::RangeBounds;
    ///
    /// assert_eq!((1..12).start_bound(), Included(&1));
    /// assert_eq!((1..12).start_bound().copied(), Included(1));
    /// ```
    #[must_use = "`self` will be dropped if the result is not used"]
    #[unstable(feature = "bound_copied", issue = ???)]
    pub fn copied(self) -> Bound<T> {
        match self {
            Bound::Unbounded => Bound::Unbounded,
            Bound::Included(x) => Bound::Included(*x),
            Bound::Excluded(x) => Bound::Excluded(*x),
        }
    }
}

Steps / History

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 RFCS-tracking-unimplementedStatus: The feature has not been implemented.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions