File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -736,6 +736,28 @@ impl<T> Bound<T> {
736736 }
737737}
738738
739+ impl < T : Copy > Bound < & T > {
740+ /// Map a `Bound<&T>` to a `Bound<T>` by copying the contents of the bound.
741+ ///
742+ /// # Examples
743+ ///
744+ /// ```
745+ /// use std::ops::Bound::*;
746+ /// use std::ops::RangeBounds;
747+ ///
748+ /// assert_eq!((1..12).start_bound(), Included(&1));
749+ /// assert_eq!((1..12).start_bound().copied(), Included(1));
750+ /// ```
751+ #[ unstable( feature = "bound_copied" , issue = "145966" ) ]
752+ pub fn copied ( self ) -> Bound < T > {
753+ match self {
754+ Bound :: Unbounded => Bound :: Unbounded ,
755+ Bound :: Included ( x) => Bound :: Included ( * x) ,
756+ Bound :: Excluded ( x) => Bound :: Excluded ( * x) ,
757+ }
758+ }
759+ }
760+
739761impl < T : Clone > Bound < & T > {
740762 /// Map a `Bound<&T>` to a `Bound<T>` by cloning the contents of the bound.
741763 ///
You can’t perform that action at this time.
0 commit comments