File tree 1 file changed +23
-0
lines changed
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -678,6 +678,29 @@ pub enum Bound<T> {
678
678
Unbounded ,
679
679
}
680
680
681
+ #[ unstable( feature = "bound_as_ref" , issue = "80996" ) ]
682
+ impl < T > Bound < T > {
683
+ /// Converts from `&Bound<T>` to `Bound<&T>`.
684
+ #[ inline]
685
+ pub fn as_ref ( & self ) -> Bound < & T > {
686
+ match * self {
687
+ Included ( ref x) => Included ( x) ,
688
+ Excluded ( ref x) => Excluded ( x) ,
689
+ Unbounded => Unbounded ,
690
+ }
691
+ }
692
+
693
+ /// Converts from `&mut Bound<T>` to `Bound<&T>`.
694
+ #[ inline]
695
+ pub fn as_mut ( & mut self ) -> Bound < & mut T > {
696
+ match * self {
697
+ Included ( ref mut x) => Included ( x) ,
698
+ Excluded ( ref mut x) => Excluded ( x) ,
699
+ Unbounded => Unbounded ,
700
+ }
701
+ }
702
+ }
703
+
681
704
impl < T : Clone > Bound < & T > {
682
705
/// Map a `Bound<&T>` to a `Bound<T>` by cloning the contents of the bound.
683
706
///
You can’t perform that action at this time.
0 commit comments