remove deprecated methods
This commit is contained in:
parent
25274e9ae1
commit
a4b243ce7e
|
@ -55,6 +55,7 @@ numeric primitives are implemented. That is, you can use [`From`] or
|
|||
* The sealed traits [`Int`] and [`Float`] now have no provided
|
||||
methods; the methods in the old implementation are new provided by
|
||||
[`FromFixed`] and [`ToFixed`].
|
||||
* Deprecated methods were removed.
|
||||
|
||||
[`Fixed`]: https://docs.rs/fixed/0.3.4/fixed/traits/trait.Fixed.html
|
||||
[`FixedSigned`]: https://docs.rs/fixed/0.3.4/fixed/traits/trait.FixedSigned.html
|
||||
|
|
|
@ -23,6 +23,7 @@ Incompatible changes
|
|||
* The sealed traits `Int` and `Float` now have no provided methods;
|
||||
the methods in the old implementation are now provided by
|
||||
`FromFixed` and `ToFixed`.
|
||||
* Deprecated methods were removed.
|
||||
|
||||
Version 0.3.3 (2019-06-27)
|
||||
==========================
|
||||
|
|
|
@ -220,8 +220,6 @@ use core::{
|
|||
hash::{Hash, Hasher},
|
||||
marker::PhantomData,
|
||||
};
|
||||
#[cfg(feature = "f16")]
|
||||
use half::f16;
|
||||
|
||||
/// A prelude for users of the *fixed* crate.
|
||||
///
|
||||
|
@ -248,8 +246,6 @@ mod macros_from_to;
|
|||
mod macros_round;
|
||||
#[macro_use]
|
||||
mod macros_checked_arith;
|
||||
#[macro_use]
|
||||
mod macros_deprecated;
|
||||
|
||||
macro_rules! fixed {
|
||||
($description:expr, $Fixed:ident($Inner:ty, $Len:tt, $s_nbits:expr), $Signedness:tt) => {
|
||||
|
@ -712,8 +708,6 @@ assert!(Fix::from_int(-5).is_negative());
|
|||
$Fixed($Inner) => fn is_negative(self) -> bool
|
||||
);
|
||||
}
|
||||
|
||||
fixed_deprecated! { $Fixed($Inner) }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,120 +0,0 @@
|
|||
// Copyright © 2018–2019 Trevor Spiteri
|
||||
|
||||
// This library is free software: you can redistribute it and/or
|
||||
// modify it under the terms of either
|
||||
//
|
||||
// * the Apache License, Version 2.0 or
|
||||
// * the MIT License
|
||||
//
|
||||
// at your option.
|
||||
//
|
||||
// You should have recieved copies of the Apache License and the MIT
|
||||
// License along with the library. If not, see
|
||||
// <https://www.apache.org/licenses/LICENSE-2.0> and
|
||||
// <https://opensource.org/licenses/MIT>.
|
||||
|
||||
macro_rules! deprecated_from_float {
|
||||
(fn $method:ident($Float:ident) -> $Fixed:ident<$Frac:ident>) => {
|
||||
comment!(
|
||||
"Creates a fixed-point number from `",
|
||||
stringify!($Float),
|
||||
"`.
|
||||
|
||||
This method has been replaced by [`checked_from_float`].
|
||||
|
||||
[`checked_from_float`]: #method.checked_from_float
|
||||
";
|
||||
#[deprecated(since = "0.2.0", note = "replaced by checked_from_float")]
|
||||
#[inline]
|
||||
pub fn $method(val: $Float) -> Option<$Fixed<$Frac>> {
|
||||
Self::checked_from_float(val)
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! deprecated_to_float {
|
||||
(fn $method:ident($Fixed:ident) -> $Float:ident) => {
|
||||
comment!(
|
||||
"Converts the fixed-point number to `",
|
||||
stringify!($Float),
|
||||
"`.
|
||||
|
||||
This method has been replaced by [`to_float`].
|
||||
|
||||
[`to_float`]: #method.to_float
|
||||
";
|
||||
#[deprecated(since = "0.2.0", note = "replaced by to_float")]
|
||||
#[inline]
|
||||
pub fn $method(self) -> $Float {
|
||||
self.to_float()
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! fixed_deprecated {
|
||||
($Fixed:ident($Inner:ty)) => {
|
||||
/// Returns the number of integer bits.
|
||||
#[inline]
|
||||
#[deprecated(since = "0.3.0", note = "renamed to int_nbits")]
|
||||
pub fn int_bits() -> u32 {
|
||||
Self::int_nbits()
|
||||
}
|
||||
|
||||
/// Returns the number of fractional bits.
|
||||
#[inline]
|
||||
#[deprecated(since = "0.3.0", note = "renamed to frac_nbits")]
|
||||
pub fn frac_bits() -> u32 {
|
||||
Self::frac_nbits()
|
||||
}
|
||||
|
||||
/// Converts the fixed-point number to an integer,
|
||||
/// rounding towards +∞.
|
||||
#[deprecated(since = "0.2.0", note = "use f.ceil().to_int::<_>() instead")]
|
||||
#[inline]
|
||||
pub fn to_int_ceil(self) -> $Inner {
|
||||
if let Some(ceil) = self.checked_ceil() {
|
||||
ceil.to_int()
|
||||
} else {
|
||||
self.floor().to_int::<$Inner>() + 1
|
||||
}
|
||||
}
|
||||
|
||||
/// Converts the fixed-point number to an integer, rounding
|
||||
/// towards −∞.
|
||||
#[deprecated(since = "0.2.0", note = "use f.floor().to_int::<_>() instead")]
|
||||
#[inline]
|
||||
pub fn to_int_floor(self) -> $Inner {
|
||||
if let Some(floor) = self.checked_floor() {
|
||||
floor.to_int()
|
||||
} else {
|
||||
self.ceil().to_int::<$Inner>() - 1
|
||||
}
|
||||
}
|
||||
|
||||
/// Converts the fixed-point number to an integer, rounding
|
||||
/// towards the nearest. Ties are rounded away from zero.
|
||||
#[deprecated(since = "0.2.0", note = "use f.round().to_int::<_>() instead")]
|
||||
#[inline]
|
||||
pub fn to_int_round(self) -> $Inner {
|
||||
if let Some(round) = self.checked_round() {
|
||||
round.to_int()
|
||||
} else if let Some(floor) = self.checked_floor() {
|
||||
floor.to_int::<$Inner>() + 1
|
||||
} else {
|
||||
self.ceil().to_int::<$Inner>() - 1
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "f16")]
|
||||
deprecated_from_float! { fn from_f16(f16) -> $Fixed<Frac> }
|
||||
deprecated_from_float! { fn from_f32(f32) -> $Fixed<Frac> }
|
||||
deprecated_from_float! { fn from_f64(f64) -> $Fixed<Frac> }
|
||||
|
||||
#[cfg(feature = "f16")]
|
||||
deprecated_to_float! { fn to_f16($Fixed) -> f16 }
|
||||
deprecated_to_float! { fn to_f32($Fixed) -> f32 }
|
||||
deprecated_to_float! { fn to_f64($Fixed) -> f64 }
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue