always implement bytemuck traits: not an optional feature

This commit is contained in:
Trevor Spiteri 2021-04-21 17:18:00 +02:00
parent 60ed86a1ec
commit 2866af5915
7 changed files with 71 additions and 165 deletions

View File

@ -36,13 +36,10 @@ f16 = []
[dependencies]
az_crate = { version = "1.1", package = "az" }
bytemuck = "1.2"
half = "1.6"
typenum = "1.10"
[dependencies.bytemuck]
version = "1.2"
optional = true
[dependencies.num-traits]
version = "0.2.13"
default-features = false

View File

@ -76,6 +76,8 @@ The conversions supported cover the following cases.
provided using the [`FromFixed`] and [`ToFixed`] traits, or using the
[`from_num`] and [`to_num`] methods and [their checked
versions][`checked_from_num`].
* Additionally, checked casts from the [*az* crate] are implemented for
conversion between fixed-point nubmers and numeric primitives.
* Fixed-point numbers can be parsed from decimal strings using [`FromStr`],
and from binary, octal and hexadecimal strings using the
[`from_str_binary`], [`from_str_octal`] and [`from_str_hex`] methods. The
@ -83,15 +85,19 @@ The conversions supported cover the following cases.
* Fixed-point numbers can be converted to strings using [`Display`],
[`Binary`], [`Octal`], [`LowerHex`] and [`UpperHex`]. The output is rounded
to the nearest, with ties rounded to even.
* All fixed-point numbers are plain old data, so bit casting conversions from
the [*bytemuck* crate] can be used.
## Whats new
### Version 1.9.0 news (unreleased)
* The new [`bytemuck`][feat-1-9] optional feature was added to implement the
[`Zeroable`][bm-z-1-2], [`Pod`][bm-p-1-2] and
[`TransparentWrapper`][bm-tw-1-2] traits provided by the [*bytemuck* crate]
for all fixed-point numbers.
* The following traits from the [*bytemuck* crate] were implemented for all
fixed-point numbers, added as supertraits to the [`Fixed`][tf-1-9] trait,
and implemented for the [`Wrapping`][w-1-9] and [`Unwrapped`][u-1-9]
wrappers.
* [`Zeroable`][bm-z-1], [`Pod`][bm-p-1]
* [`TransparentWrapper`][bm-tw-1]
#### Compatibility notes
@ -99,23 +105,25 @@ The conversions supported cover the following cases.
[`LeEqU64`][leu64-1-9] and [`LeEqU128`][leu128-1-9] traits now have a
`'static` constraint. This should have no practical side effects, since
these traits are a convenience feature and already have the
[`Unsigned`][u-1-9] marker trait as a supertrait, and the types that
implement [`Unsigned`][u-1-9] are `'static`.
[`Unsigned`][uns-1-9] marker trait as a supertrait, and the types that
implement [`Unsigned`][uns-1-9] are `'static`.
* The [`FixedOptionalFeatures`][fof-1-9] trait was not sealed as an oversight.
Now the glitch has been fixed and it is sealed. The documentation now
explicitly states that the trait should not be used directly.
[bm-p-1-2]: https://docs.rs/bytemuck/^1/bytemuck/trait.Pod.html
[bm-tw-1-2]: https://docs.rs/bytemuck/^1/bytemuck/trait.TransparentWrapper.html
[bm-z-1-2]: https://docs.rs/bytemuck/^1/bytemuck/trait.Zeroable.html
[feat-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/index.html#optional-features
[bm-p-1]: https://docs.rs/bytemuck/^1/bytemuck/trait.Pod.html
[bm-tw-1]: https://docs.rs/bytemuck/^1/bytemuck/trait.TransparentWrapper.html
[bm-z-1]: https://docs.rs/bytemuck/^1/bytemuck/trait.Zeroable.html
[fof-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/traits/trait.FixedOptionalFeatures.html
[leu128-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/types/extra/trait.LeEqU128.html
[leu16-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/types/extra/trait.LeEqU16.html
[leu32-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/types/extra/trait.LeEqU32.html
[leu64-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/types/extra/trait.LeEqU64.html
[leu8-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/types/extra/trait.LeEqU8.html
[u-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/types/extra/trait.Unsigned.html
[tf-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/traits/trait.Fixed.html
[u-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/struct.Unwrapped.html
[uns-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/types/extra/trait.Unsigned.html
[w-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/struct.Wrapping.html
### Version 1.8.0 news (2021-04-20)
@ -264,14 +272,12 @@ The *fixed* crate requires rustc version 1.50.0 or later.
The *fixed* crate has these optional feature:
1. `bytemuck`, disabled by default. This implements some traits from the
[*bytemuck* crate].
2. `serde`, disabled by default. This provides serialization support for the
1. `serde`, disabled by default. This provides serialization support for the
fixed-point types. This feature requires the [*serde* crate].
3. `std`, disabled by default. This is for features that are not possible under
2. `std`, disabled by default. This is for features that are not possible under
`no_std`: currently the implementation of the [`Error`] trait for
[`ParseFixedError`].
4. `serde-str`, disabled by default. Fixed-point numbers are serialized as
3. `serde-str`, disabled by default. Fixed-point numbers are serialized as
strings showing the value when using human-readable formats. This feature
requires the `serde` and the `std` optional features. **Warning:** numbers
serialized when this feature is enabled cannot be deserialized when this

View File

@ -8,10 +8,12 @@ as-is, without any warranty. -->
Version 1.9.0 (unreleased)
==========================
* The new [`bytemuck`][feat-1-9] optional feature was added to implement the
[`Zeroable`][bm-z-1-2], [`Pod`][bm-p-1-2] and
[`TransparentWrapper`][bm-tw-1-2] traits provided by the [*bytemuck* crate]
for all fixed-point numbers.
* The following traits from the [*bytemuck* crate] were implemented for all
fixed-point numbers, added as supertraits to the [`Fixed`][tf-1-9] trait,
and implemented for the [`Wrapping`][w-1-9] and [`Unwrapped`][u-1-9]
wrappers.
* [`Zeroable`][bm-z-1], [`Pod`][bm-p-1]
* [`TransparentWrapper`][bm-tw-1]
Compatibility notes
-------------------
@ -20,23 +22,25 @@ Compatibility notes
[`LeEqU64`][leu64-1-9] and [`LeEqU128`][leu128-1-9] traits now have a
`'static` constraint. This should have no practical side effects, since
these traits are a convenience feature and already have the
[`Unsigned`][u-1-9] marker trait as a supertrait, and the types that
implement [`Unsigned`][u-1-9] are `'static`.
[`Unsigned`][uns-1-9] marker trait as a supertrait, and the types that
implement [`Unsigned`][uns-1-9] are `'static`.
* The [`FixedOptionalFeatures`][fof-1-9] trait was not sealed as an oversight.
Now the glitch has been fixed and it is sealed. The documentation now
explicitly states that the trait should not be used directly.
[bm-p-1-2]: https://docs.rs/bytemuck/^1/bytemuck/trait.Pod.html
[bm-tw-1-2]: https://docs.rs/bytemuck/^1/bytemuck/trait.TransparentWrapper.html
[bm-z-1-2]: https://docs.rs/bytemuck/^1/bytemuck/trait.Zeroable.html
[feat-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/index.html#optional-features
[bm-p-1]: https://docs.rs/bytemuck/^1/bytemuck/trait.Pod.html
[bm-tw-1]: https://docs.rs/bytemuck/^1/bytemuck/trait.TransparentWrapper.html
[bm-z-1]: https://docs.rs/bytemuck/^1/bytemuck/trait.Zeroable.html
[fof-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/traits/trait.FixedOptionalFeatures.html
[leu128-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/types/extra/trait.LeEqU128.html
[leu16-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/types/extra/trait.LeEqU16.html
[leu32-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/types/extra/trait.LeEqU32.html
[leu64-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/types/extra/trait.LeEqU64.html
[leu8-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/types/extra/trait.LeEqU8.html
[u-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/types/extra/trait.Unsigned.html
[tf-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/traits/trait.Fixed.html
[u-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/struct.Unwrapped.html
[uns-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/types/extra/trait.Unsigned.html
[w-1-9]: https://tspiteri.gitlab.io/fixed/dev/fixed/struct.Wrapping.html
Version 1.8.0 (2021-04-20)
==========================

View File

@ -32,9 +32,9 @@ before_test:
- bash -c "if [ -d $USERPROFILE/.cargo/registry/cache ]; then cd $USERPROFILE/.cargo/registry; find cache -name \*.crate | sort; fi"
test_script:
- cargo +beta-%TARGET% clippy --all-targets --features "fail-on-warnings bytemuck num-traits serde std"
- cargo +beta-%TARGET% test --release --features "fail-on-warnings bytemuck num-traits serde std"
- cargo +1.50.0-%TARGET% test --lib --features "fail-on-warnings bytemuck num-traits serde std"
- cargo +beta-%TARGET% clippy --all-targets --features "fail-on-warnings num-traits serde std"
- cargo +beta-%TARGET% test --release --features "fail-on-warnings num-traits serde std"
- cargo +1.50.0-%TARGET% test --lib --features "fail-on-warnings num-traits serde std"
after_test:
- bash -c "if [ -d $USERPROFILE/.cargo/registry/cache ]; then cd $USERPROFILE/.cargo/registry; for c in cache/*/*.crate; do s=src/${c#cache/}; if [ ! -e ${s/.crate/} ]; then rm -v $c; fi; done; find cache -name \*.crate | sort; fi"

View File

@ -29,10 +29,10 @@ x86_64-gnulinux:
- cargo/
script:
- rustup toolchain install --profile minimal beta-$TARGET 1.50.0-$TARGET
- cargo +beta-$TARGET test --features "fail-on-warnings bytemuck num-traits serde std"
- cargo +beta-$TARGET test --release --features "fail-on-warnings bytemuck num-traits serde std"
- cargo +1.50.0-$TARGET test --lib --features "fail-on-warnings bytemuck num-traits serde std"
- cargo +1.50.0-$TARGET test --release --lib --features "fail-on-warnings bytemuck num-traits serde std"
- cargo +beta-$TARGET test --features "fail-on-warnings num-traits serde std"
- cargo +beta-$TARGET test --release --features "fail-on-warnings num-traits serde std"
- cargo +1.50.0-$TARGET test --lib --features "fail-on-warnings num-traits serde std"
- cargo +1.50.0-$TARGET test --release --lib --features "fail-on-warnings num-traits serde std"
i686-gnulinux:
image: i386/rust:1
@ -44,10 +44,10 @@ i686-gnulinux:
- cargo/
script:
- rustup toolchain install --profile minimal beta-$TARGET 1.50.0-$TARGET
- cargo +beta-$TARGET test --features "fail-on-warnings bytemuck num-traits serde std"
- cargo +beta-$TARGET test --release --features "fail-on-warnings bytemuck num-traits serde std"
- cargo +1.50.0-$TARGET test --lib --features "fail-on-warnings bytemuck num-traits serde std"
- cargo +1.50.0-$TARGET test --release --lib --features "fail-on-warnings bytemuck num-traits serde std"
- cargo +beta-$TARGET test --features "fail-on-warnings num-traits serde std"
- cargo +beta-$TARGET test --release --features "fail-on-warnings num-traits serde std"
- cargo +1.50.0-$TARGET test --lib --features "fail-on-warnings num-traits serde std"
- cargo +1.50.0-$TARGET test --release --lib --features "fail-on-warnings num-traits serde std"
x86_64-gnulinux-tidy:
image: amd64/rust:1
@ -61,14 +61,6 @@ x86_64-gnulinux-tidy:
- rustup toolchain install --profile minimal beta-$TARGET
- rustup component add --toolchain beta-$TARGET rustfmt clippy
- cargo +beta-$TARGET fmt -- --check
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings bytemuck num-traits serde std"
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings bytemuck num-traits serde"
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings bytemuck num-traits std"
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings bytemuck num-traits"
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings bytemuck serde std"
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings bytemuck serde"
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings bytemuck std"
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings bytemuck"
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings num-traits serde std"
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings num-traits serde"
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings num-traits std"
@ -90,14 +82,6 @@ i686-gnulinux-tidy:
- rustup toolchain install --profile minimal beta-$TARGET
- rustup component add --toolchain beta-$TARGET rustfmt clippy
- cargo +beta-$TARGET fmt -- --check
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings bytemuck num-traits serde std"
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings bytemuck num-traits serde"
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings bytemuck num-traits std"
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings bytemuck num-traits"
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings bytemuck serde std"
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings bytemuck serde"
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings bytemuck std"
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings bytemuck"
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings num-traits serde std"
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings num-traits serde"
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings num-traits std"
@ -119,7 +103,7 @@ x86_64-gnulinux-tarpaulin:
script:
- rustup toolchain install --profile minimal beta-$TARGET
- cargo +beta-$TARGET install --version 0.16.0 --locked cargo-tarpaulin
- stdbuf -oL cargo +beta-$TARGET tarpaulin -v --ignore-tests --exclude-files build.rs --features "bytemuck num-traits serde std" | tee tarpaulin.log
- stdbuf -oL cargo +beta-$TARGET tarpaulin -v --ignore-tests --exclude-files build.rs --features "num-traits serde std" | tee tarpaulin.log
- echo "Check that coverage not less than $REQ_COVERAGE%"
- tail -1 tarpaulin.log | awk '{ if ($1 < '$REQ_COVERAGE') { exit 1 } }'
@ -135,7 +119,7 @@ pages:
- rustup toolchain install --profile minimal nightly-$TARGET
- rm -rf public
- mkdir public
- cargo +nightly-$TARGET doc --no-deps --features "bytemuck num-traits serde std" -Z rustdoc-map
- cargo +nightly-$TARGET doc --no-deps --features "num-traits serde std" -Z rustdoc-map
- mv target/doc public/dev
- bash etc/gen-doc-index.sh
artifacts:

View File

@ -85,6 +85,8 @@ The conversions supported cover the following cases.
provided using the [`FromFixed`] and [`ToFixed`] traits, or using the
[`from_num`] and [`to_num`] methods and [their checked
versions][`checked_from_num`].
* Additionally, checked casts from the [*az* crate] are implemented for
conversion between fixed-point nubmers and numeric primitives.
* Fixed-point numbers can be parsed from decimal strings using [`FromStr`],
and from binary, octal and hexadecimal strings using the
[`from_str_binary`], [`from_str_octal`] and [`from_str_hex`] methods. The
@ -92,6 +94,8 @@ The conversions supported cover the following cases.
* Fixed-point numbers can be converted to strings using [`Display`],
[`Binary`], [`Octal`], [`LowerHex`] and [`UpperHex`]. The output is rounded
to the nearest, with ties rounded to even.
* All fixed-point numbers are plain old data, so bit casting conversions from
the [*bytemuck* crate] can be used.
## Quick examples
@ -178,14 +182,12 @@ The *fixed* crate requires rustc version 1.50.0 or later.
The *fixed* crate has these optional feature:
1. `bytemuck`, disabled by default. This implements some traits from the
[*bytemuck* crate].
2. `serde`, disabled by default. This provides serialization support for the
1. `serde`, disabled by default. This provides serialization support for the
fixed-point types. This feature requires the [*serde* crate].
3. `std`, disabled by default. This is for features that are not possible under
2. `std`, disabled by default. This is for features that are not possible under
`no_std`: currently the implementation of the [`Error`] trait for
[`ParseFixedError`].
4. `serde-str`, disabled by default. Fixed-point numbers are serialized as
3. `serde-str`, disabled by default. Fixed-point numbers are serialized as
strings showing the value when using human-readable formats. This feature
requires the `serde` and the `std` optional features. **Warning:** numbers
serialized when this feature is enabled cannot be deserialized when this
@ -299,7 +301,6 @@ mod display;
mod float_helper;
mod from_str;
mod helpers;
#[cfg(feature = "bytemuck")]
mod impl_bytemuck;
#[cfg(feature = "num-traits")]
mod impl_num_traits;

View File

@ -23,7 +23,6 @@ use crate::{
F128Bits, FixedI128, FixedI16, FixedI32, FixedI64, FixedI8, FixedU128, FixedU16, FixedU32,
FixedU64, FixedU8, ParseFixedError,
};
#[cfg(feature = "bytemuck")]
use bytemuck::{Pod, TransparentWrapper, Zeroable};
use core::{
fmt::{Binary, Debug, Display, LowerHex, Octal, UpperHex},
@ -60,24 +59,16 @@ use serde::{de::Deserialize, ser::Serialize};
macro_rules! comment_features {
($comment:expr) => {
#[cfg(all(
not(feature = "bytemuck"),
not(feature = "num-traits"),
not(feature = "serde")
))]
#[cfg(all(not(feature = "num-traits"), not(feature = "serde")))]
doc_comment! {
$comment;
pub trait FixedOptionalFeatures<Bits>: Sealed {}
pub trait FixedOptionalFeatures: Sealed {}
}
#[cfg(all(
not(feature = "bytemuck"),
not(feature = "num-traits"),
feature = "serde"
))]
#[cfg(all(not(feature = "num-traits"), feature = "serde"))]
doc_comment! {
$comment;
pub trait FixedOptionalFeatures<Bits>: Sealed
pub trait FixedOptionalFeatures: Sealed
where
Self: Serialize + for<'de> Deserialize<'de>
{
@ -85,14 +76,10 @@ macro_rules! comment_features {
}
// Do *not* add MulAdd constaint, as it conflicts with Fixed::mul_add
#[cfg(all(
not(feature = "bytemuck"),
feature = "num-traits",
not(feature = "serde")
))]
#[cfg(all(feature = "num-traits", not(feature = "serde")))]
doc_comment! {
$comment;
pub trait FixedOptionalFeatures<Bits>: Sealed
pub trait FixedOptionalFeatures: Sealed
where
Self: Zero + Bounded + Inv,
Self: CheckedAdd + CheckedSub + CheckedNeg + CheckedMul,
@ -107,10 +94,10 @@ macro_rules! comment_features {
}
// Do *not* add MulAdd constaint, as it conflicts with Fixed::mul_add
#[cfg(all(not(feature = "bytemuck"), feature = "num-traits", feature = "serde"))]
#[cfg(all(feature = "num-traits", feature = "serde"))]
doc_comment! {
$comment;
pub trait FixedOptionalFeatures<Bits>: Sealed
pub trait FixedOptionalFeatures: Sealed
where
Self: Zero + Bounded + Inv,
Self: CheckedAdd + CheckedSub + CheckedNeg + CheckedMul,
@ -124,74 +111,6 @@ macro_rules! comment_features {
{
}
}
#[cfg(all(
feature = "bytemuck",
not(feature = "num-traits"),
not(feature = "serde")
))]
doc_comment! {
$comment;
pub trait FixedOptionalFeatures<Bits>: Sealed
where
Self: Zeroable + Pod,
Self: TransparentWrapper<Bits>,
{
}
}
#[cfg(all(feature = "bytemuck", not(feature = "num-traits"), feature = "serde"))]
doc_comment! {
$comment;
pub trait FixedOptionalFeatures<Bits>: Sealed
where
Self: Zeroable + Pod,
Self: TransparentWrapper<Bits>,
Self: Serialize + for<'de> Deserialize<'de>,
{
}
}
// Do *not* add MulAdd constaint, as it conflicts with Fixed::mul_add
#[cfg(all(feature = "bytemuck", feature = "num-traits", not(feature = "serde")))]
doc_comment! {
$comment;
pub trait FixedOptionalFeatures<Bits>: Sealed
where
Self: Zeroable + Pod,
Self: TransparentWrapper<Bits>,
Self: Zero + Bounded + Inv,
Self: CheckedAdd + CheckedSub + CheckedNeg + CheckedMul,
Self: CheckedDiv + CheckedRem + CheckedShl + CheckedShr,
Self: SaturatingAdd + SaturatingSub + SaturatingMul,
Self: WrappingAdd + WrappingSub + WrappingNeg + WrappingMul,
Self: WrappingShl + WrappingShr,
Self: OverflowingAdd + OverflowingSub + OverflowingMul,
Self: ToPrimitive + FromPrimitive + FloatConst,
{
}
}
// Do *not* add MulAdd constaint, as it conflicts with Fixed::mul_add
#[cfg(all(feature = "bytemuck", feature = "num-traits", feature = "serde"))]
doc_comment! {
$comment;
pub trait FixedOptionalFeatures<Bits>: Sealed
where
Self: Zeroable + Pod,
Self: TransparentWrapper<Bits>,
Self: Zero + Bounded + Inv,
Self: CheckedAdd + CheckedSub + CheckedNeg + CheckedMul,
Self: CheckedDiv + CheckedRem + CheckedShl + CheckedShr,
Self: SaturatingAdd + SaturatingSub + SaturatingMul,
Self: WrappingAdd + WrappingSub + WrappingNeg + WrappingMul,
Self: WrappingShl + WrappingShr,
Self: OverflowingAdd + OverflowingSub + OverflowingMul,
Self: ToPrimitive + FromPrimitive + FloatConst,
Self: Serialize + for<'de> Deserialize<'de>,
{
}
}
};
}
@ -199,13 +118,7 @@ comment_features! {
r#"This trait is used to provide supertraits to the [`Fixed`] trait
depending on the crates [optional features], and should not be used directly.
1. If the `bytemuck` feature is enabled, the following are supertraits of
[`Fixed`]:
* [`Zeroable`], [`Pod`]
* [`TransparentWrapper`]
2. If the `num-traits` experimental feature is enabled, the following
1. If the `num-traits` experimental feature is enabled, the following
are supertraits of [`Fixed`]:
* [`Zero`]
@ -236,7 +149,7 @@ depending on the crates [optional features], and should not be used directly.
[`FixedSigned`] and [`FixedUnsigned`] because they have [`Num`] as
a supertrait.
3. If the `serde` feature is enabled, [`Serialize`] and
2. If the `serde` feature is enabled, [`Serialize`] and
[`Deserialize`] are supertraits of [`Fixed`].
[`MulAddAssign`]: num_traits::ops::mul_add::MulAddAssign
@ -378,7 +291,8 @@ where
Self: PartialOrd<f16> + PartialOrd<bf16>,
Self: PartialOrd<f32> + PartialOrd<f64>,
Self: PartialOrd<F128Bits>,
Self: FixedOptionalFeatures<<Self as Fixed>::Bits>,
Self: Zeroable + Pod + TransparentWrapper<<Self as Fixed>::Bits>,
Self: FixedOptionalFeatures,
Self: Sealed,
{
/// The primitive integer underlying type.
@ -3169,7 +3083,7 @@ macro_rules! trait_delegate {
macro_rules! impl_fixed {
($Fixed:ident, $UFixed:ident, $LeEqU:ident, $Bits:ident, $Signedness:tt) => {
impl<Frac: $LeEqU> FixedOptionalFeatures<$Bits> for $Fixed<Frac> {}
impl<Frac: $LeEqU> FixedOptionalFeatures for $Fixed<Frac> {}
impl<Frac: $LeEqU> Fixed for $Fixed<Frac> {
type Bits = $Bits;