File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,12 @@ impl<T> Ordered<T> {
112
112
/// The inner type is public so this function is never explicitly needed.
113
113
pub const fn new ( inner : T ) -> Self { Self ( inner) }
114
114
115
+ /// Creates an `Ordered<T>` from a reference.
116
+ ///
117
+ /// This allows: `let found = map.get(Ordered::from_ref(&a));`
118
+ #[ allow( clippy:: ptr_as_ptr) ]
119
+ pub fn from_ref ( value : & T ) -> & Self { unsafe { & * ( value as * const _ as * const Self ) } }
120
+
115
121
/// Returns a reference to the inner object.
116
122
///
117
123
/// We also implement [`core::borrow::Borrow`] so this function is never explicitly needed.
@@ -121,12 +127,6 @@ impl<T> Ordered<T> {
121
127
///
122
128
/// We also implement [`core::ops::Deref`] so this function is never explicitly needed.
123
129
pub fn into_inner ( self ) -> T { self . 0 }
124
-
125
- /// Creates an `Ordered<T>` from a reference.
126
- ///
127
- /// This allows: `let found = map.get(Ordered::from_ref(&a));`
128
- #[ allow( clippy:: ptr_as_ptr) ]
129
- pub fn from_ref ( value : & T ) -> & Self { unsafe { & * ( value as * const _ as * const Self ) } }
130
130
}
131
131
132
132
impl < T : ArbitraryOrd > ArbitraryOrd for & T {
You can’t perform that action at this time.
0 commit comments