link to core libs instead of std libs where possible
This commit is contained in:
parent
be35c826da
commit
59bc0bfd26
16
README.md
16
README.md
|
@ -234,8 +234,8 @@ additional terms or conditions.
|
||||||
[*typenum* crate]: https://crates.io/crates/typenum
|
[*typenum* crate]: https://crates.io/crates/typenum
|
||||||
[LICENSE-APACHE]: https://www.apache.org/licenses/LICENSE-2.0
|
[LICENSE-APACHE]: https://www.apache.org/licenses/LICENSE-2.0
|
||||||
[LICENSE-MIT]: https://opensource.org/licenses/MIT
|
[LICENSE-MIT]: https://opensource.org/licenses/MIT
|
||||||
[`Binary`]: https://doc.rust-lang.org/nightly/std/fmt/trait.Binary.html
|
[`Binary`]: https://doc.rust-lang.org/nightly/core/fmt/trait.Binary.html
|
||||||
[`Display`]: https://doc.rust-lang.org/nightly/std/fmt/trait.Display.html
|
[`Display`]: https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html
|
||||||
[`FixedI128`]: https://docs.rs/fixed/0.5.0/fixed/struct.FixedI128.html
|
[`FixedI128`]: https://docs.rs/fixed/0.5.0/fixed/struct.FixedI128.html
|
||||||
[`FixedI16`]: https://docs.rs/fixed/0.5.0/fixed/struct.FixedI16.html
|
[`FixedI16`]: https://docs.rs/fixed/0.5.0/fixed/struct.FixedI16.html
|
||||||
[`FixedI32`]: https://docs.rs/fixed/0.5.0/fixed/struct.FixedI32.html
|
[`FixedI32`]: https://docs.rs/fixed/0.5.0/fixed/struct.FixedI32.html
|
||||||
|
@ -247,20 +247,20 @@ additional terms or conditions.
|
||||||
[`FixedU64`]: https://docs.rs/fixed/0.5.0/fixed/struct.FixedU64.html
|
[`FixedU64`]: https://docs.rs/fixed/0.5.0/fixed/struct.FixedU64.html
|
||||||
[`FixedU8`]: https://docs.rs/fixed/0.5.0/fixed/struct.FixedU8.html
|
[`FixedU8`]: https://docs.rs/fixed/0.5.0/fixed/struct.FixedU8.html
|
||||||
[`FromFixed`]: https://docs.rs/fixed/0.5.0/fixed/traits/trait.FromFixed.html
|
[`FromFixed`]: https://docs.rs/fixed/0.5.0/fixed/traits/trait.FromFixed.html
|
||||||
[`FromStr`]: https://doc.rust-lang.org/nightly/std/str/trait.FromStr.html
|
[`FromStr`]: https://doc.rust-lang.org/nightly/core/str/trait.FromStr.html
|
||||||
[`From`]: https://doc.rust-lang.org/nightly/std/convert/trait.From.html
|
[`From`]: https://doc.rust-lang.org/nightly/core/convert/trait.From.html
|
||||||
[`I20F12`]: https://docs.rs/fixed/0.5.0/fixed/types/type.I20F12.html
|
[`I20F12`]: https://docs.rs/fixed/0.5.0/fixed/types/type.I20F12.html
|
||||||
[`I4F12`]: https://docs.rs/fixed/0.5.0/fixed/types/type.I4F12.html
|
[`I4F12`]: https://docs.rs/fixed/0.5.0/fixed/types/type.I4F12.html
|
||||||
[`I4F4`]: https://docs.rs/fixed/0.5.0/fixed/types/type.I4F4.html
|
[`I4F4`]: https://docs.rs/fixed/0.5.0/fixed/types/type.I4F4.html
|
||||||
[`Into`]: https://doc.rust-lang.org/nightly/std/convert/trait.Into.html
|
[`Into`]: https://doc.rust-lang.org/nightly/core/convert/trait.Into.html
|
||||||
[`LossyFrom`]: https://docs.rs/fixed/0.5.0/fixed/traits/trait.LossyFrom.html
|
[`LossyFrom`]: https://docs.rs/fixed/0.5.0/fixed/traits/trait.LossyFrom.html
|
||||||
[`LossyInto`]: https://docs.rs/fixed/0.5.0/fixed/traits/trait.LossyInto.html
|
[`LossyInto`]: https://docs.rs/fixed/0.5.0/fixed/traits/trait.LossyInto.html
|
||||||
[`LowerHex`]: https://doc.rust-lang.org/nightly/std/fmt/trait.LowerHex.html
|
[`LowerHex`]: https://doc.rust-lang.org/nightly/core/fmt/trait.LowerHex.html
|
||||||
[`Octal`]: https://doc.rust-lang.org/nightly/std/fmt/trait.Octal.html
|
[`Octal`]: https://doc.rust-lang.org/nightly/core/fmt/trait.Octal.html
|
||||||
[`ToFixed`]: https://docs.rs/fixed/0.5.0/fixed/traits/trait.ToFixed.html
|
[`ToFixed`]: https://docs.rs/fixed/0.5.0/fixed/traits/trait.ToFixed.html
|
||||||
[`U12`]: https://docs.rs/fixed/0.5.0/fixed/types/extra/type.U12.html
|
[`U12`]: https://docs.rs/fixed/0.5.0/fixed/types/extra/type.U12.html
|
||||||
[`U20F12`]: https://docs.rs/fixed/0.5.0/fixed/types/type.U20F12.html
|
[`U20F12`]: https://docs.rs/fixed/0.5.0/fixed/types/type.U20F12.html
|
||||||
[`UpperHex`]: https://doc.rust-lang.org/nightly/std/fmt/trait.UpperHex.html
|
[`UpperHex`]: https://doc.rust-lang.org/nightly/core/fmt/trait.UpperHex.html
|
||||||
[`bf16`]: https://docs.rs/half/^1/half/struct.bf16.html
|
[`bf16`]: https://docs.rs/half/^1/half/struct.bf16.html
|
||||||
[`checked_from_num`]: https://docs.rs/fixed/0.5.0/fixed/struct.FixedI32.html#method.checked_from_num
|
[`checked_from_num`]: https://docs.rs/fixed/0.5.0/fixed/struct.FixedI32.html#method.checked_from_num
|
||||||
[`f16`]: https://docs.rs/half/^1/half/struct.f16.html
|
[`f16`]: https://docs.rs/half/^1/half/struct.f16.html
|
||||||
|
|
16
src/lib.rs
16
src/lib.rs
|
@ -188,8 +188,8 @@ additional terms or conditions.
|
||||||
[*typenum* crate]: https://crates.io/crates/typenum
|
[*typenum* crate]: https://crates.io/crates/typenum
|
||||||
[LICENSE-APACHE]: https://www.apache.org/licenses/LICENSE-2.0
|
[LICENSE-APACHE]: https://www.apache.org/licenses/LICENSE-2.0
|
||||||
[LICENSE-MIT]: https://opensource.org/licenses/MIT
|
[LICENSE-MIT]: https://opensource.org/licenses/MIT
|
||||||
[`Binary`]: https://doc.rust-lang.org/nightly/std/fmt/trait.Binary.html
|
[`Binary`]: https://doc.rust-lang.org/nightly/core/fmt/trait.Binary.html
|
||||||
[`Display`]: https://doc.rust-lang.org/nightly/std/fmt/trait.Display.html
|
[`Display`]: https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html
|
||||||
[`FixedI128`]: struct.FixedI128.html
|
[`FixedI128`]: struct.FixedI128.html
|
||||||
[`FixedI16`]: struct.FixedI16.html
|
[`FixedI16`]: struct.FixedI16.html
|
||||||
[`FixedI32`]: struct.FixedI32.html
|
[`FixedI32`]: struct.FixedI32.html
|
||||||
|
@ -201,20 +201,20 @@ additional terms or conditions.
|
||||||
[`FixedU64`]: struct.FixedU64.html
|
[`FixedU64`]: struct.FixedU64.html
|
||||||
[`FixedU8`]: struct.FixedU8.html
|
[`FixedU8`]: struct.FixedU8.html
|
||||||
[`FromFixed`]: traits/trait.FromFixed.html
|
[`FromFixed`]: traits/trait.FromFixed.html
|
||||||
[`FromStr`]: https://doc.rust-lang.org/nightly/std/str/trait.FromStr.html
|
[`FromStr`]: https://doc.rust-lang.org/nightly/core/str/trait.FromStr.html
|
||||||
[`From`]: https://doc.rust-lang.org/nightly/std/convert/trait.From.html
|
[`From`]: https://doc.rust-lang.org/nightly/core/convert/trait.From.html
|
||||||
[`I20F12`]: types/type.I20F12.html
|
[`I20F12`]: types/type.I20F12.html
|
||||||
[`I4F12`]: types/type.I4F12.html
|
[`I4F12`]: types/type.I4F12.html
|
||||||
[`I4F4`]: types/type.I4F4.html
|
[`I4F4`]: types/type.I4F4.html
|
||||||
[`Into`]: https://doc.rust-lang.org/nightly/std/convert/trait.Into.html
|
[`Into`]: https://doc.rust-lang.org/nightly/core/convert/trait.Into.html
|
||||||
[`LossyFrom`]: traits/trait.LossyFrom.html
|
[`LossyFrom`]: traits/trait.LossyFrom.html
|
||||||
[`LossyInto`]: traits/trait.LossyInto.html
|
[`LossyInto`]: traits/trait.LossyInto.html
|
||||||
[`LowerHex`]: https://doc.rust-lang.org/nightly/std/fmt/trait.LowerHex.html
|
[`LowerHex`]: https://doc.rust-lang.org/nightly/core/fmt/trait.LowerHex.html
|
||||||
[`Octal`]: https://doc.rust-lang.org/nightly/std/fmt/trait.Octal.html
|
[`Octal`]: https://doc.rust-lang.org/nightly/core/fmt/trait.Octal.html
|
||||||
[`ToFixed`]: traits/trait.ToFixed.html
|
[`ToFixed`]: traits/trait.ToFixed.html
|
||||||
[`U12`]: types/extra/type.U12.html
|
[`U12`]: types/extra/type.U12.html
|
||||||
[`U20F12`]: types/type.U20F12.html
|
[`U20F12`]: types/type.U20F12.html
|
||||||
[`UpperHex`]: https://doc.rust-lang.org/nightly/std/fmt/trait.UpperHex.html
|
[`UpperHex`]: https://doc.rust-lang.org/nightly/core/fmt/trait.UpperHex.html
|
||||||
[`bf16`]: https://docs.rs/half/^1/half/struct.bf16.html
|
[`bf16`]: https://docs.rs/half/^1/half/struct.bf16.html
|
||||||
[`checked_from_num`]: struct.FixedI32.html#method.checked_from_num
|
[`checked_from_num`]: struct.FixedI32.html#method.checked_from_num
|
||||||
[`f16`]: https://docs.rs/half/^1/half/struct.f16.html
|
[`f16`]: https://docs.rs/half/^1/half/struct.f16.html
|
||||||
|
|
|
@ -149,7 +149,7 @@ assert_eq!(Fix::max_value().checked_mul(Fix::from_num(1)), Some(Fix::max_value()
|
||||||
assert_eq!(Fix::max_value().checked_mul(Fix::from_num(2)), None);
|
assert_eq!(Fix::max_value().checked_mul(Fix::from_num(2)), None);
|
||||||
```
|
```
|
||||||
|
|
||||||
[`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
[`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
";
|
";
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn checked_mul(self, rhs: $Fixed<Frac>) -> Option<$Fixed<Frac>> {
|
pub fn checked_mul(self, rhs: $Fixed<Frac>) -> Option<$Fixed<Frac>> {
|
||||||
|
@ -173,7 +173,7 @@ assert_eq!(Fix::max_value().checked_div(Fix::from_num(1)), Some(Fix::max_value()
|
||||||
assert_eq!(Fix::max_value().checked_div(Fix::from_num(1) / 2), None);
|
assert_eq!(Fix::max_value().checked_div(Fix::from_num(1) / 2), None);
|
||||||
```
|
```
|
||||||
|
|
||||||
[`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
[`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
";
|
";
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn checked_div(self, rhs: $Fixed<Frac>) -> Option<$Fixed<Frac>> {
|
pub fn checked_div(self, rhs: $Fixed<Frac>) -> Option<$Fixed<Frac>> {
|
||||||
|
|
|
@ -242,7 +242,7 @@ assert!(Fix::checked_from_num(2e38).is_none());
|
||||||
assert!(Fix::checked_from_num(std::f64::NAN).is_none());
|
assert!(Fix::checked_from_num(std::f64::NAN).is_none());
|
||||||
```
|
```
|
||||||
|
|
||||||
[`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
[`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
[`ToFixed`]: traits/trait.ToFixed.html
|
[`ToFixed`]: traits/trait.ToFixed.html
|
||||||
[`bf16`]: https://docs.rs/half/^1.2/half/struct.bf16.html
|
[`bf16`]: https://docs.rs/half/^1.2/half/struct.bf16.html
|
||||||
[`f16` feature]: index.html#optional-features
|
[`f16` feature]: index.html#optional-features
|
||||||
|
@ -329,7 +329,7 @@ assert_eq!(one_point_625.checked_to_num::<f32>(), Some(1.625f32));
|
||||||
```
|
```
|
||||||
|
|
||||||
[`FromFixed`]: traits/trait.FromFixed.html
|
[`FromFixed`]: traits/trait.FromFixed.html
|
||||||
[`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
[`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
[`bf16`]: https://docs.rs/half/^1.2/half/struct.bf16.html
|
[`bf16`]: https://docs.rs/half/^1.2/half/struct.bf16.html
|
||||||
[`checked_from_fixed`]: traits/trait.FromFixed.html#tymethod.checked_from_fixed
|
[`checked_from_fixed`]: traits/trait.FromFixed.html#tymethod.checked_from_fixed
|
||||||
[`f16` feature]: index.html#optional-features
|
[`f16` feature]: index.html#optional-features
|
||||||
|
|
|
@ -568,7 +568,7 @@ assert_eq!(Fix::from_num(5).checked_neg(), None);",
|
||||||
"
|
"
|
||||||
```
|
```
|
||||||
|
|
||||||
[`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
[`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
";
|
";
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn checked_neg(self) -> Option<$Fixed<Frac>> {
|
pub fn checked_neg(self) -> Option<$Fixed<Frac>> {
|
||||||
|
@ -589,7 +589,7 @@ assert_eq!((Fix::max_value() - one).checked_add(one), Some(Fix::max_value()));
|
||||||
assert_eq!(Fix::max_value().checked_add(one), None);
|
assert_eq!(Fix::max_value().checked_add(one), None);
|
||||||
```
|
```
|
||||||
|
|
||||||
[`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
[`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
";
|
";
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn checked_add(self, rhs: $Fixed<Frac>) -> Option<$Fixed<Frac>> {
|
pub fn checked_add(self, rhs: $Fixed<Frac>) -> Option<$Fixed<Frac>> {
|
||||||
|
@ -610,7 +610,7 @@ assert_eq!((Fix::min_value() + one).checked_sub(one), Some(Fix::min_value()));
|
||||||
assert_eq!(Fix::min_value().checked_sub(one), None);
|
assert_eq!(Fix::min_value().checked_sub(one), None);
|
||||||
```
|
```
|
||||||
|
|
||||||
[`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
[`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
";
|
";
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn checked_sub(self, rhs: $Fixed<Frac>) -> Option<$Fixed<Frac>> {
|
pub fn checked_sub(self, rhs: $Fixed<Frac>) -> Option<$Fixed<Frac>> {
|
||||||
|
@ -631,7 +631,7 @@ assert_eq!(Fix::max_value().checked_mul_int(1), Some(Fix::max_value()));
|
||||||
assert_eq!(Fix::max_value().checked_mul_int(2), None);
|
assert_eq!(Fix::max_value().checked_mul_int(2), None);
|
||||||
```
|
```
|
||||||
|
|
||||||
[`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
[`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
";
|
";
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn checked_mul_int(self, rhs: $Inner) -> Option<$Fixed<Frac>> {
|
pub fn checked_mul_int(self, rhs: $Inner) -> Option<$Fixed<Frac>> {
|
||||||
|
@ -664,7 +664,7 @@ assert_eq!(Fix::from_num(1).checked_div_int(0), None);
|
||||||
},
|
},
|
||||||
"```
|
"```
|
||||||
|
|
||||||
[`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
[`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
";
|
";
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn checked_div_int(self, rhs: $Inner) -> Option<$Fixed<Frac>> {
|
pub fn checked_div_int(self, rhs: $Inner) -> Option<$Fixed<Frac>> {
|
||||||
|
@ -698,7 +698,7 @@ assert_eq!(Fix::from_num(1).checked_rem_int(0), None);
|
||||||
},
|
},
|
||||||
"```
|
"```
|
||||||
|
|
||||||
[`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
[`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
";
|
";
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn checked_rem_int(self, rhs: $Inner) -> Option<$Fixed<Frac>> {
|
pub fn checked_rem_int(self, rhs: $Inner) -> Option<$Fixed<Frac>> {
|
||||||
|
@ -731,7 +731,7 @@ assert_eq!(Fix::min_value().checked_div_int(-1), None);
|
||||||
},
|
},
|
||||||
"```
|
"```
|
||||||
|
|
||||||
[`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
[`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
";
|
";
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn checked_div_euclid_int(self, rhs: $Inner) -> Option<$Fixed<Frac>> {
|
pub fn checked_div_euclid_int(self, rhs: $Inner) -> Option<$Fixed<Frac>> {
|
||||||
|
@ -764,7 +764,7 @@ assert_eq!(Fix::min_value().checked_rem_euclid_int(-1), None);
|
||||||
},
|
},
|
||||||
"```
|
"```
|
||||||
|
|
||||||
[`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
[`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
";
|
";
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn checked_rem_euclid_int(self, rhs: $Inner) -> Option<$Fixed<Frac>> {
|
pub fn checked_rem_euclid_int(self, rhs: $Inner) -> Option<$Fixed<Frac>> {
|
||||||
|
@ -785,7 +785,7 @@ assert_eq!((Fix::from_num(1) / 2).checked_shl(3), Some(Fix::from_num(4)));
|
||||||
assert_eq!((Fix::from_num(1) / 2).checked_shl(", $s_nbits, "), None);
|
assert_eq!((Fix::from_num(1) / 2).checked_shl(", $s_nbits, "), None);
|
||||||
```
|
```
|
||||||
|
|
||||||
[`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
[`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
";
|
";
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn checked_shl(self, rhs: u32) -> Option<$Fixed<Frac>> {
|
pub fn checked_shl(self, rhs: u32) -> Option<$Fixed<Frac>> {
|
||||||
|
@ -806,7 +806,7 @@ assert_eq!(Fix::from_num(4).checked_shr(3), Some(Fix::from_num(1) / 2));
|
||||||
assert_eq!(Fix::from_num(4).checked_shr(", $s_nbits, "), None);
|
assert_eq!(Fix::from_num(4).checked_shr(", $s_nbits, "), None);
|
||||||
```
|
```
|
||||||
|
|
||||||
[`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
[`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
";
|
";
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn checked_shr(self, rhs: u32) -> Option<$Fixed<Frac>> {
|
pub fn checked_shr(self, rhs: u32) -> Option<$Fixed<Frac>> {
|
||||||
|
@ -830,7 +830,7 @@ assert_eq!(Fix::from_num(-5).checked_abs(), Some(Fix::from_num(5)));
|
||||||
assert_eq!(Fix::min_value().checked_abs(), None);
|
assert_eq!(Fix::min_value().checked_abs(), None);
|
||||||
```
|
```
|
||||||
|
|
||||||
[`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
[`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
";
|
";
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn checked_abs(self) -> Option<$Fixed<Frac>> {
|
pub fn checked_abs(self) -> Option<$Fixed<Frac>> {
|
||||||
|
@ -858,7 +858,7 @@ assert_eq!(three_eights.checked_next_power_of_two(), Some(half));
|
||||||
assert!(Fix::max_value().checked_next_power_of_two().is_none());
|
assert!(Fix::max_value().checked_next_power_of_two().is_none());
|
||||||
```
|
```
|
||||||
|
|
||||||
[`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
[`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
";
|
";
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn checked_next_power_of_two(self) -> Option<$Fixed<Frac>> {
|
pub fn checked_next_power_of_two(self) -> Option<$Fixed<Frac>> {
|
||||||
|
|
|
@ -318,7 +318,7 @@ assert_eq!(Fix::from_num(2.5).checked_ceil(), Some(Fix::from_num(3)));
|
||||||
"assert!(Fix::max_value().checked_ceil().is_none());
|
"assert!(Fix::max_value().checked_ceil().is_none());
|
||||||
```
|
```
|
||||||
|
|
||||||
[`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
[`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
";
|
";
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn checked_ceil(self) -> Option<$Fixed<Frac>> {
|
pub fn checked_ceil(self) -> Option<$Fixed<Frac>> {
|
||||||
|
@ -368,9 +368,9 @@ assert!(AllFrac::min_value().checked_floor().is_none());
|
||||||
if_signed_unsigned! {
|
if_signed_unsigned! {
|
||||||
$Signedness,
|
$Signedness,
|
||||||
"
|
"
|
||||||
[`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None",
|
[`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None",
|
||||||
"
|
"
|
||||||
[`Some`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.Some",
|
[`Some`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.Some",
|
||||||
},
|
},
|
||||||
"
|
"
|
||||||
";
|
";
|
||||||
|
@ -400,7 +400,7 @@ assert_eq!(Fix::from_num(2.5).checked_round(), Some(Fix::from_num(3)));
|
||||||
"assert!(Fix::max_value().checked_round().is_none());
|
"assert!(Fix::max_value().checked_round().is_none());
|
||||||
```
|
```
|
||||||
|
|
||||||
[`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
[`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
";
|
";
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn checked_round(self) -> Option<$Fixed<Frac>> {
|
pub fn checked_round(self) -> Option<$Fixed<Frac>> {
|
||||||
|
@ -423,7 +423,7 @@ assert_eq!(Fix::from_num(3.5).checked_round_ties_to_even(), Some(Fix::from_num(4
|
||||||
assert!(Fix::max_value().checked_round_ties_to_even().is_none());
|
assert!(Fix::max_value().checked_round_ties_to_even().is_none());
|
||||||
```
|
```
|
||||||
|
|
||||||
[`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
[`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
";
|
";
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn checked_round_ties_to_even(self) -> Option<$Fixed<Frac>> {
|
pub fn checked_round_ties_to_even(self) -> Option<$Fixed<Frac>> {
|
||||||
|
|
|
@ -82,7 +82,7 @@ depending on the crate’s [optional features].
|
||||||
|
|
||||||
[`Deserialize`]: https://docs.rs/serde/^1/serde/de/trait.Deserialize.html
|
[`Deserialize`]: https://docs.rs/serde/^1/serde/de/trait.Deserialize.html
|
||||||
[`Fixed`]: trait.Fixed.html
|
[`Fixed`]: trait.Fixed.html
|
||||||
[`PartialOrd`]: https://doc.rust-lang.org/nightly/std/cmp/trait.PartialOrd.html
|
[`PartialOrd`]: https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html
|
||||||
[`Serialize`]: https://docs.rs/serde/^1/serde/ser/trait.Serialize.html
|
[`Serialize`]: https://docs.rs/serde/^1/serde/ser/trait.Serialize.html
|
||||||
[`bf16`]: https://docs.rs/half/^1/half/struct.bf16.html
|
[`bf16`]: https://docs.rs/half/^1/half/struct.bf16.html
|
||||||
[`f16`]: https://docs.rs/half/^1/half/struct.f16.html
|
[`f16`]: https://docs.rs/half/^1/half/struct.f16.html
|
||||||
|
@ -202,8 +202,8 @@ depending on the crate’s [optional features].
|
||||||
/// [`FixedU64`]: ../struct.FixedU64.html
|
/// [`FixedU64`]: ../struct.FixedU64.html
|
||||||
/// [`FixedU8`]: ../struct.FixedU8.html
|
/// [`FixedU8`]: ../struct.FixedU8.html
|
||||||
/// [`FixedUnsigned`]: trait.FixedUnsigned.html
|
/// [`FixedUnsigned`]: trait.FixedUnsigned.html
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
/// [`TryFrom`]: https://doc.rust-lang.org/nightly/std/convert/trait.TryFrom.html
|
/// [`TryFrom`]: https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html
|
||||||
/// [`i16`]: https://doc.rust-lang.org/nightly/std/primitive.i16.html
|
/// [`i16`]: https://doc.rust-lang.org/nightly/std/primitive.i16.html
|
||||||
/// [`i8`]: https://doc.rust-lang.org/nightly/std/primitive.i8.html
|
/// [`i8`]: https://doc.rust-lang.org/nightly/std/primitive.i8.html
|
||||||
/// [`u16`]: https://doc.rust-lang.org/nightly/std/primitive.u16.html
|
/// [`u16`]: https://doc.rust-lang.org/nightly/std/primitive.u16.html
|
||||||
|
@ -308,7 +308,7 @@ where
|
||||||
///
|
///
|
||||||
/// Returns the same value as [`src.checked_to_fixed()`][`checked_to_fixed`].
|
/// Returns the same value as [`src.checked_to_fixed()`][`checked_to_fixed`].
|
||||||
///
|
///
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
/// [`checked_to_fixed`]: trait.ToFixed.html#tymethod.checked_to_fixed
|
/// [`checked_to_fixed`]: trait.ToFixed.html#tymethod.checked_to_fixed
|
||||||
fn checked_from_num<Src: ToFixed>(src: Src) -> Option<Self>;
|
fn checked_from_num<Src: ToFixed>(src: Src) -> Option<Self>;
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ where
|
||||||
///
|
///
|
||||||
/// Returns the same value as [`Dst::checked_from_fixed(self)`][`checked_from_fixed`].
|
/// Returns the same value as [`Dst::checked_from_fixed(self)`][`checked_from_fixed`].
|
||||||
///
|
///
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
/// [`checked_from_fixed`]: trait.FromFixed.html#tymethod.checked_from_fixed
|
/// [`checked_from_fixed`]: trait.FromFixed.html#tymethod.checked_from_fixed
|
||||||
fn checked_to_num<Dst: FromFixed>(self) -> Option<Dst>;
|
fn checked_to_num<Dst: FromFixed>(self) -> Option<Dst>;
|
||||||
|
|
||||||
|
@ -476,25 +476,25 @@ where
|
||||||
/// Checked ceil. Rounds to the next integer towards +∞, returning
|
/// Checked ceil. Rounds to the next integer towards +∞, returning
|
||||||
/// [`None`] on overflow.
|
/// [`None`] on overflow.
|
||||||
///
|
///
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
fn checked_ceil(self) -> Option<Self>;
|
fn checked_ceil(self) -> Option<Self>;
|
||||||
|
|
||||||
/// Checked floor. Rounds to the next integer towards −∞, returning
|
/// Checked floor. Rounds to the next integer towards −∞, returning
|
||||||
/// [`None`] on overflow.
|
/// [`None`] on overflow.
|
||||||
///
|
///
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
fn checked_floor(self) -> Option<Self>;
|
fn checked_floor(self) -> Option<Self>;
|
||||||
|
|
||||||
/// Checked round. Rounds to the nearest integer, with ties
|
/// Checked round. Rounds to the nearest integer, with ties
|
||||||
/// rounded away from zero, returning [`None`] on overflow.
|
/// rounded away from zero, returning [`None`] on overflow.
|
||||||
///
|
///
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
fn checked_round(self) -> Option<Self>;
|
fn checked_round(self) -> Option<Self>;
|
||||||
|
|
||||||
/// Checked round. Rounds to the nearest integer, with ties
|
/// Checked round. Rounds to the nearest integer, with ties
|
||||||
/// rounded to even, returning [`None`] on overflow.
|
/// rounded to even, returning [`None`] on overflow.
|
||||||
///
|
///
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
fn checked_round_ties_to_even(self) -> Option<Self>;
|
fn checked_round_ties_to_even(self) -> Option<Self>;
|
||||||
|
|
||||||
/// Saturating ceil. Rounds to the next integer towards +∞,
|
/// Saturating ceil. Rounds to the next integer towards +∞,
|
||||||
|
@ -605,74 +605,74 @@ where
|
||||||
|
|
||||||
/// Checked negation. Returns the negated value, or [`None`] on overflow.
|
/// Checked negation. Returns the negated value, or [`None`] on overflow.
|
||||||
///
|
///
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
fn checked_neg(self) -> Option<Self>;
|
fn checked_neg(self) -> Option<Self>;
|
||||||
|
|
||||||
/// Checked addition. Returns the sum, or [`None`] on overflow.
|
/// Checked addition. Returns the sum, or [`None`] on overflow.
|
||||||
///
|
///
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
fn checked_add(self, rhs: Self) -> Option<Self>;
|
fn checked_add(self, rhs: Self) -> Option<Self>;
|
||||||
|
|
||||||
/// Checked subtraction. Returns the difference, or [`None`] on overflow.
|
/// Checked subtraction. Returns the difference, or [`None`] on overflow.
|
||||||
///
|
///
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
fn checked_sub(self, rhs: Self) -> Option<Self>;
|
fn checked_sub(self, rhs: Self) -> Option<Self>;
|
||||||
|
|
||||||
/// Checked multiplication. Returns the product, or [`None`] on overflow.
|
/// Checked multiplication. Returns the product, or [`None`] on overflow.
|
||||||
///
|
///
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
fn checked_mul(self, rhs: Self) -> Option<Self>;
|
fn checked_mul(self, rhs: Self) -> Option<Self>;
|
||||||
|
|
||||||
/// Checked division. Returns the quotient, or [`None`] if the
|
/// Checked division. Returns the quotient, or [`None`] if the
|
||||||
/// divisor is zero or on overflow.
|
/// divisor is zero or on overflow.
|
||||||
///
|
///
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
fn checked_div(self, rhs: Self) -> Option<Self>;
|
fn checked_div(self, rhs: Self) -> Option<Self>;
|
||||||
|
|
||||||
/// Checked multiplication by an integer. Returns the product, or
|
/// Checked multiplication by an integer. Returns the product, or
|
||||||
/// [`None`] on overflow.
|
/// [`None`] on overflow.
|
||||||
///
|
///
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
fn checked_mul_int(self, rhs: Self::Bits) -> Option<Self>;
|
fn checked_mul_int(self, rhs: Self::Bits) -> Option<Self>;
|
||||||
|
|
||||||
/// Checked division by an integer. Returns the quotient, or
|
/// Checked division by an integer. Returns the quotient, or
|
||||||
/// [`None`] if the divisor is zero or if the division results in
|
/// [`None`] if the divisor is zero or if the division results in
|
||||||
/// overflow.
|
/// overflow.
|
||||||
///
|
///
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
fn checked_div_int(self, rhs: Self::Bits) -> Option<Self>;
|
fn checked_div_int(self, rhs: Self::Bits) -> Option<Self>;
|
||||||
|
|
||||||
/// Checked fixed-point remainder for division by an integer.
|
/// Checked fixed-point remainder for division by an integer.
|
||||||
/// Returns the remainder, or [`None`] if the divisor is zero or
|
/// Returns the remainder, or [`None`] if the divisor is zero or
|
||||||
/// if the division results in overflow.
|
/// if the division results in overflow.
|
||||||
///
|
///
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
fn checked_rem_int(self, rhs: Self::Bits) -> Option<Self>;
|
fn checked_rem_int(self, rhs: Self::Bits) -> Option<Self>;
|
||||||
|
|
||||||
/// Checked Euclidean division by an integer. Returns the
|
/// Checked Euclidean division by an integer. Returns the
|
||||||
/// quotient, or [`None`] if the divisor is zero or if the
|
/// quotient, or [`None`] if the divisor is zero or if the
|
||||||
/// division results in overflow.
|
/// division results in overflow.
|
||||||
///
|
///
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
fn checked_div_euclid_int(self, rhs: Self::Bits) -> Option<Self>;
|
fn checked_div_euclid_int(self, rhs: Self::Bits) -> Option<Self>;
|
||||||
|
|
||||||
/// Checked fixed-point remainder for Euclidean division by an
|
/// Checked fixed-point remainder for Euclidean division by an
|
||||||
/// integer. Returns the remainder, or [`None`] if the divisor is
|
/// integer. Returns the remainder, or [`None`] if the divisor is
|
||||||
/// zero or if the division results in overflow.
|
/// zero or if the division results in overflow.
|
||||||
///
|
///
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
fn checked_rem_euclid_int(self, rhs: Self::Bits) -> Option<Self>;
|
fn checked_rem_euclid_int(self, rhs: Self::Bits) -> Option<Self>;
|
||||||
|
|
||||||
/// Checked shift left. Returns the shifted number, or [`None`] if
|
/// Checked shift left. Returns the shifted number, or [`None`] if
|
||||||
/// `rhs` ≥ the number of bits.
|
/// `rhs` ≥ the number of bits.
|
||||||
///
|
///
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
fn checked_shl(self, rhs: u32) -> Option<Self>;
|
fn checked_shl(self, rhs: u32) -> Option<Self>;
|
||||||
|
|
||||||
/// Checked shift right. Returns the shifted number, or [`None`]
|
/// Checked shift right. Returns the shifted number, or [`None`]
|
||||||
/// if `rhs` ≥ the number of bits.
|
/// if `rhs` ≥ the number of bits.
|
||||||
///
|
///
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
fn checked_shr(self, rhs: u32) -> Option<Self>;
|
fn checked_shr(self, rhs: u32) -> Option<Self>;
|
||||||
|
|
||||||
/// Saturated negation. Returns the negated value, saturating on overflow.
|
/// Saturated negation. Returns the negated value, saturating on overflow.
|
||||||
|
@ -959,7 +959,7 @@ pub trait FixedSigned: Fixed + Neg<Output = Self> {
|
||||||
///
|
///
|
||||||
/// Overflow can only occur when trying to find the absolute value of the minimum value.
|
/// Overflow can only occur when trying to find the absolute value of the minimum value.
|
||||||
///
|
///
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
fn checked_abs(self) -> Option<Self>;
|
fn checked_abs(self) -> Option<Self>;
|
||||||
|
|
||||||
/// Saturating absolute value. Returns the absolute value, saturating on overflow.
|
/// Saturating absolute value. Returns the absolute value, saturating on overflow.
|
||||||
|
@ -1011,7 +1011,7 @@ pub trait FixedUnsigned: Fixed {
|
||||||
/// Returns the smallest power of two that is ≥ `self`, or [`None`] if the
|
/// Returns the smallest power of two that is ≥ `self`, or [`None`] if the
|
||||||
/// next power of two is too large to represent.
|
/// next power of two is too large to represent.
|
||||||
///
|
///
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
fn checked_next_power_of_two(self) -> Option<Self>;
|
fn checked_next_power_of_two(self) -> Option<Self>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1053,8 +1053,8 @@ pub trait LossyFrom<Src> {
|
||||||
/// assert_eq!(lossy, I12F4::from_bits(0x0012));
|
/// assert_eq!(lossy, I12F4::from_bits(0x0012));
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// [`From`]: https://doc.rust-lang.org/nightly/std/convert/trait.From.html
|
/// [`From`]: https://doc.rust-lang.org/nightly/core/convert/trait.From.html
|
||||||
/// [`Into`]: https://doc.rust-lang.org/nightly/std/convert/trait.Into.html
|
/// [`Into`]: https://doc.rust-lang.org/nightly/core/convert/trait.Into.html
|
||||||
/// [`LossyFrom`]: trait.LossyFrom.html
|
/// [`LossyFrom`]: trait.LossyFrom.html
|
||||||
pub trait LossyInto<Dst> {
|
pub trait LossyInto<Dst> {
|
||||||
/// Performs the conversion.
|
/// Performs the conversion.
|
||||||
|
@ -1111,7 +1111,7 @@ pub trait FromFixed {
|
||||||
///
|
///
|
||||||
/// Any extra fractional bits are truncated.
|
/// Any extra fractional bits are truncated.
|
||||||
///
|
///
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
fn checked_from_fixed<F: Fixed>(src: F) -> Option<Self>
|
fn checked_from_fixed<F: Fixed>(src: F) -> Option<Self>
|
||||||
where
|
where
|
||||||
Self: Sized;
|
Self: Sized;
|
||||||
|
@ -1187,7 +1187,7 @@ pub trait ToFixed {
|
||||||
///
|
///
|
||||||
/// Any extra fractional bits are truncated.
|
/// Any extra fractional bits are truncated.
|
||||||
///
|
///
|
||||||
/// [`None`]: https://doc.rust-lang.org/nightly/std/option/enum.Option.html#variant.None
|
/// [`None`]: https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.None
|
||||||
fn checked_to_fixed<F: Fixed>(self) -> Option<F>;
|
fn checked_to_fixed<F: Fixed>(self) -> Option<F>;
|
||||||
|
|
||||||
/// Converts to a fixed-point number, saturating if it does not fit.
|
/// Converts to a fixed-point number, saturating if it does not fit.
|
||||||
|
|
Loading…
Reference in New Issue