Add associated consts MIN/MAX for Wrapping<Int>
This commit is contained in:
parent
b85e3fe010
commit
b2c44696ad
1 changed files with 4 additions and 12 deletions
|
@ -337,14 +337,10 @@ Basic usage:
|
||||||
#![feature(wrapping_int_impl)]
|
#![feature(wrapping_int_impl)]
|
||||||
use std::num::Wrapping;
|
use std::num::Wrapping;
|
||||||
|
|
||||||
assert_eq!(<Wrapping<", stringify!($t), ">>::min_value(), ",
|
assert_eq!(<Wrapping<", stringify!($t), ">>::MIN, Wrapping(", stringify!($t), "::MIN));
|
||||||
"Wrapping(", stringify!($t), "::min_value()));
|
|
||||||
```"),
|
```"),
|
||||||
#[unstable(feature = "wrapping_int_impl", issue = "32463")]
|
#[unstable(feature = "wrapping_int_impl", issue = "32463")]
|
||||||
#[inline]
|
pub const MIN: Self = Self(<$t>::MIN);
|
||||||
pub const fn min_value() -> Self {
|
|
||||||
Wrapping(<$t>::min_value())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
doc_comment! {
|
doc_comment! {
|
||||||
|
@ -358,14 +354,10 @@ Basic usage:
|
||||||
#![feature(wrapping_int_impl)]
|
#![feature(wrapping_int_impl)]
|
||||||
use std::num::Wrapping;
|
use std::num::Wrapping;
|
||||||
|
|
||||||
assert_eq!(<Wrapping<", stringify!($t), ">>::max_value(), ",
|
assert_eq!(<Wrapping<", stringify!($t), ">>::MAX, Wrapping(", stringify!($t), "::MAX));
|
||||||
"Wrapping(", stringify!($t), "::max_value()));
|
|
||||||
```"),
|
```"),
|
||||||
#[unstable(feature = "wrapping_int_impl", issue = "32463")]
|
#[unstable(feature = "wrapping_int_impl", issue = "32463")]
|
||||||
#[inline]
|
pub const MAX: Self = Self(<$t>::MAX);
|
||||||
pub const fn max_value() -> Self {
|
|
||||||
Wrapping(<$t>::max_value())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
doc_comment! {
|
doc_comment! {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue