File tree 3 files changed +13
-19
lines changed
3 files changed +13
-19
lines changed Original file line number Diff line number Diff line change @@ -238,15 +238,12 @@ where
238
238
/// let array3 = <&[_; 3]>::from(&color);
239
239
/// ```
240
240
#[ inline]
241
- pub fn into_array_ref < T > ( value : & T ) -> & T :: Array
241
+ pub const fn into_array_ref < T > ( value : & T ) -> & T :: Array
242
242
where
243
243
T : ArrayCast ,
244
244
{
245
- assert_eq ! ( core:: mem:: size_of:: <T :: Array >( ) , core:: mem:: size_of:: <T >( ) ) ;
246
- assert_eq ! (
247
- core:: mem:: align_of:: <T :: Array >( ) ,
248
- core:: mem:: align_of:: <T >( )
249
- ) ;
245
+ assert ! ( core:: mem:: size_of:: <T :: Array >( ) == core:: mem:: size_of:: <T >( ) ) ;
246
+ assert ! ( core:: mem:: align_of:: <T :: Array >( ) == core:: mem:: align_of:: <T >( ) ) ;
250
247
251
248
let value: * const T = value;
252
249
@@ -282,15 +279,12 @@ where
282
279
/// let color3 = <&Srgb<u8>>::from(&array);
283
280
/// ```
284
281
#[ inline]
285
- pub fn from_array_ref < T > ( value : & T :: Array ) -> & T
282
+ pub const fn from_array_ref < T > ( value : & T :: Array ) -> & T
286
283
where
287
284
T : ArrayCast ,
288
285
{
289
- assert_eq ! ( core:: mem:: size_of:: <T :: Array >( ) , core:: mem:: size_of:: <T >( ) ) ;
290
- assert_eq ! (
291
- core:: mem:: align_of:: <T :: Array >( ) ,
292
- core:: mem:: align_of:: <T >( )
293
- ) ;
286
+ assert ! ( core:: mem:: size_of:: <T :: Array >( ) == core:: mem:: size_of:: <T >( ) ) ;
287
+ assert ! ( core:: mem:: align_of:: <T :: Array >( ) == core:: mem:: align_of:: <T >( ) ) ;
294
288
295
289
let value: * const T :: Array = value;
296
290
Original file line number Diff line number Diff line change @@ -110,12 +110,12 @@ where
110
110
/// assert_eq!(cast::into_uint_ref(&color), &0xFF17C64C);
111
111
/// ```
112
112
#[ inline]
113
- pub fn into_uint_ref < T > ( value : & T ) -> & T :: Uint
113
+ pub const fn into_uint_ref < T > ( value : & T ) -> & T :: Uint
114
114
where
115
115
T : UintCast ,
116
116
{
117
- assert_eq ! ( core:: mem:: size_of:: <T :: Uint >( ) , core:: mem:: size_of:: <T >( ) ) ;
118
- assert_eq ! ( core:: mem:: align_of:: <T :: Uint >( ) , core:: mem:: align_of:: <T >( ) ) ;
117
+ assert ! ( core:: mem:: size_of:: <T :: Uint >( ) == core:: mem:: size_of:: <T >( ) ) ;
118
+ assert ! ( core:: mem:: align_of:: <T :: Uint >( ) == core:: mem:: align_of:: <T >( ) ) ;
119
119
120
120
let value: * const T = value;
121
121
@@ -133,12 +133,12 @@ where
133
133
/// assert_eq!(cast::from_uint_ref::<PackedArgb>(&0xFF17C64C), &color);
134
134
/// ```
135
135
#[ inline]
136
- pub fn from_uint_ref < T > ( value : & T :: Uint ) -> & T
136
+ pub const fn from_uint_ref < T > ( value : & T :: Uint ) -> & T
137
137
where
138
138
T : UintCast ,
139
139
{
140
- assert_eq ! ( core:: mem:: size_of:: <T :: Uint >( ) , core:: mem:: size_of:: <T >( ) ) ;
141
- assert_eq ! ( core:: mem:: align_of:: <T :: Uint >( ) , core:: mem:: align_of:: <T >( ) ) ;
140
+ assert ! ( core:: mem:: size_of:: <T :: Uint >( ) == core:: mem:: size_of:: <T >( ) ) ;
141
+ assert ! ( core:: mem:: align_of:: <T :: Uint >( ) == core:: mem:: align_of:: <T >( ) ) ;
142
142
143
143
let value: * const T :: Uint = value;
144
144
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ macro_rules! make_hues {
81
81
impl <T : RealAngle > $name<T > {
82
82
/// Create a new hue from degrees. This is an alias for `new`.
83
83
#[ inline]
84
- pub fn from_degrees( degrees: T ) -> Self {
84
+ pub const fn from_degrees( degrees: T ) -> Self {
85
85
Self :: new( degrees)
86
86
}
87
87
You can’t perform that action at this time.
0 commit comments