stabilize unwrapped feature
This commit is contained in:
parent
389a634064
commit
b510e4cb21
|
@ -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 az f16 num-traits serde std unwrapped"
|
||||
- cargo +beta-%TARGET% test --release --features "fail-on-warnings az f16 num-traits serde std unwrapped"
|
||||
- cargo +1.44.0-%TARGET% test --lib --features "fail-on-warnings az f16 num-traits serde std unwrapped"
|
||||
- cargo +beta-%TARGET% clippy --all-targets --features "fail-on-warnings az f16 num-traits serde std"
|
||||
- cargo +beta-%TARGET% test --release --features "fail-on-warnings az f16 num-traits serde std"
|
||||
- cargo +1.44.0-%TARGET% test --lib --features "fail-on-warnings az f16 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"
|
||||
|
|
|
@ -29,10 +29,10 @@ x86_64-gnulinux:
|
|||
- cargo/
|
||||
script:
|
||||
- rustup toolchain install --profile minimal beta-$TARGET 1.44.0-$TARGET
|
||||
- cargo +beta-$TARGET test --features "fail-on-warnings az f16 num-traits serde std unwrapped"
|
||||
- cargo +beta-$TARGET test --release --features "fail-on-warnings az f16 num-traits serde std unwrapped"
|
||||
- cargo +1.44.0-$TARGET test --lib --features "fail-on-warnings az f16 num-traits serde std unwrapped"
|
||||
- cargo +1.44.0-$TARGET test --release --lib --features "fail-on-warnings az f16 num-traits serde std unwrapped"
|
||||
- cargo +beta-$TARGET test --features "fail-on-warnings az f16 num-traits serde std"
|
||||
- cargo +beta-$TARGET test --release --features "fail-on-warnings az f16 num-traits serde std"
|
||||
- cargo +1.44.0-$TARGET test --lib --features "fail-on-warnings az f16 num-traits serde std"
|
||||
- cargo +1.44.0-$TARGET test --release --lib --features "fail-on-warnings az f16 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.44.0-$TARGET
|
||||
- cargo +beta-$TARGET test --features "fail-on-warnings az f16 num-traits serde std unwrapped"
|
||||
- cargo +beta-$TARGET test --release --features "fail-on-warnings az f16 num-traits serde std unwrapped"
|
||||
- cargo +1.44.0-$TARGET test --lib --features "fail-on-warnings az f16 num-traits serde std unwrapped"
|
||||
- cargo +1.44.0-$TARGET test --release --lib --features "fail-on-warnings az f16 num-traits serde std unwrapped"
|
||||
- cargo +beta-$TARGET test --features "fail-on-warnings az f16 num-traits serde std"
|
||||
- cargo +beta-$TARGET test --release --features "fail-on-warnings az f16 num-traits serde std"
|
||||
- cargo +1.44.0-$TARGET test --lib --features "fail-on-warnings az f16 num-traits serde std"
|
||||
- cargo +1.44.0-$TARGET test --release --lib --features "fail-on-warnings az f16 num-traits serde std"
|
||||
|
||||
x86_64-gnulinux-tidy:
|
||||
image: amd64/rust:1
|
||||
|
@ -61,69 +61,37 @@ 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 az f16 num-traits serde std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 num-traits serde std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 num-traits serde unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 num-traits serde"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 num-traits std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 num-traits std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 num-traits unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 num-traits"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 serde std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 serde std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 serde unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 serde"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az num-traits serde std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az num-traits serde std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az num-traits serde unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az num-traits serde"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az num-traits std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az num-traits std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az num-traits unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az num-traits"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az serde std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az serde std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az serde unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az serde"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 num-traits serde std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 num-traits serde std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 num-traits serde unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 num-traits serde"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 num-traits std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 num-traits std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 num-traits unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 num-traits"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 serde std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 serde std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 serde unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 serde"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings num-traits serde std unwrapped"
|
||||
- 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 unwrapped"
|
||||
- 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 unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings num-traits std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings num-traits unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings num-traits"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings serde std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings serde std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings serde unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings serde"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features fail-on-warnings
|
||||
|
||||
i686-gnulinux-tidy:
|
||||
|
@ -138,69 +106,37 @@ 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 az f16 num-traits serde std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 num-traits serde std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 num-traits serde unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 num-traits serde"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 num-traits std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 num-traits std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 num-traits unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 num-traits"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 serde std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 serde std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 serde unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 serde"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16 unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az f16"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az num-traits serde std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az num-traits serde std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az num-traits serde unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az num-traits serde"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az num-traits std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az num-traits std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az num-traits unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az num-traits"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az serde std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az serde std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az serde unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az serde"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings az"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 num-traits serde std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 num-traits serde std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 num-traits serde unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 num-traits serde"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 num-traits std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 num-traits std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 num-traits unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 num-traits"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 serde std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 serde std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 serde unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 serde"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16 unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings f16"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings num-traits serde std unwrapped"
|
||||
- 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 unwrapped"
|
||||
- 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 unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings num-traits std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings num-traits unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings num-traits"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings serde std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings serde std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings serde unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings serde"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings std unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings std"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features "fail-on-warnings unwrapped"
|
||||
- cargo +beta-$TARGET clippy --all-targets --features fail-on-warnings
|
||||
|
||||
|
||||
|
@ -216,7 +152,7 @@ x86_64-gnulinux-tarpaulin:
|
|||
script:
|
||||
- rustup toolchain install --profile minimal beta-$TARGET
|
||||
- cargo +beta-$TARGET install --version 0.15.0 --locked cargo-tarpaulin
|
||||
- stdbuf -oL cargo +beta-$TARGET tarpaulin -v --ignore-tests --exclude-files build.rs --features "az f16 num-traits serde std unwrapped" | tee tarpaulin.log
|
||||
- stdbuf -oL cargo +beta-$TARGET tarpaulin -v --ignore-tests --exclude-files build.rs --features "az f16 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 } }'
|
||||
|
||||
|
@ -233,7 +169,7 @@ pages:
|
|||
- rm -rf public
|
||||
- mkdir public
|
||||
- cp doc/index.html public
|
||||
- cargo +nightly-$TARGET doc --no-deps --features "az f16 num-traits serde std unwrapped"
|
||||
- cargo +nightly-$TARGET doc --no-deps --features "az f16 num-traits serde std"
|
||||
- mv target/doc public/dev
|
||||
artifacts:
|
||||
paths:
|
||||
|
|
|
@ -23,7 +23,6 @@ autobenches = false
|
|||
f16 = ["half"]
|
||||
fail-on-warnings = []
|
||||
std = []
|
||||
unwrapped = []
|
||||
serde-str = ["serde", "std", "serde/std"]
|
||||
|
||||
[dependencies]
|
||||
|
@ -40,7 +39,7 @@ criterion = "0.3"
|
|||
num-traits = { version = "0.2", default-features = false }
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
features = ["az", "f16", "num-traits", "serde", "std", "unwrapped"]
|
||||
features = ["az", "f16", "num-traits", "serde", "std"]
|
||||
|
||||
[[bench]]
|
||||
name = "bench_main"
|
||||
|
|
18
README.md
18
README.md
|
@ -82,6 +82,12 @@ The conversions supported cover the following cases.
|
|||
|
||||
* The [`wide_mul`][f-wm-1-5] method was added to all fixed-point
|
||||
numbers up to 64 bits wide ([issue 25]).
|
||||
* Unwrapped methods for arithmetic together with the
|
||||
[`Unwrapped`][unw-1-5] wrapper were added. Unwrapped methods panic
|
||||
on overflow, even when debug assertions are disabled, similar to
|
||||
how wrapping methods will wrap around even when debug assertions
|
||||
are enabled. (This was previously an experimental feature
|
||||
`unwrapped`.)
|
||||
* The [`serde-str`][feat-1-5] feature was added. (This was
|
||||
previously an experimental feature.)
|
||||
* For the experimental feature [`num-traits`][feat-exp-1-5], some
|
||||
|
@ -93,6 +99,7 @@ The conversions supported cover the following cases.
|
|||
[feat-exp-1-5]: https://tspiteri.gitlab.io/fixed/dev/fixed/#experimental-optional-features
|
||||
[issue 25]: https://gitlab.com/tspiteri/fixed/-/issues/25
|
||||
[tfof-1-5]: https://tspiteri.gitlab.io/fixed/dev/fixed/traits/trait.FixedOptionalFeatures.html
|
||||
[unw-1-5]: https://tspiteri.gitlab.io/fixed/dev/fixed/struct.Unwrapped.html
|
||||
|
||||
### Version 1.4.0 news (2020-10-22)
|
||||
|
||||
|
@ -287,17 +294,12 @@ removed. The removal of experimental features would however require a
|
|||
minor version bump. Similarly, on a minor version bump, optional
|
||||
dependencies can be updated to an incompatible newer version.
|
||||
|
||||
There are three experimental feature:
|
||||
There is one experimental feature:
|
||||
|
||||
1. `num-traits`, disabled by default. This implements some traits
|
||||
from the [*num-traits* crate]. (The plan is to upgrade this to an
|
||||
optional feature once *num-traits* reaches version 1.0.0.)
|
||||
2. `unwrapped`, disabled by default. This adds methods for arithmetic
|
||||
that panic on overflow even when debug assertions are disabled,
|
||||
similar to how wrapping methods will wrap even when debug
|
||||
assertions are enabled. (The plan is to always enable this
|
||||
functionality but remove the experimental feature in version
|
||||
1.5.0.)
|
||||
optional feature once the [*num-traits* crate] reaches version
|
||||
1.0.0.)
|
||||
|
||||
## License
|
||||
|
||||
|
|
|
@ -10,6 +10,12 @@ Version 1.5.0 (unreleased)
|
|||
|
||||
* The [`wide_mul`][f-wm-1-5] method was added to all fixed-point
|
||||
numbers up to 64 bits wide ([issue 25]).
|
||||
* Unwrapped methods for arithmetic together with the
|
||||
[`Unwrapped`][unw-1-5] wrapper were added. Unwrapped methods panic
|
||||
on overflow, even when debug assertions are disabled, similar to
|
||||
how wrapping methods will wrap around even when debug assertions
|
||||
are enabled. (This was previously an experimental feature
|
||||
`unwrapped`.)
|
||||
* The [`serde-str`][feat-1-5] feature was added. (This was
|
||||
previously an experimental feature.)
|
||||
* For the experimental feature [`num-traits`][feat-exp-1-5], some
|
||||
|
@ -21,6 +27,7 @@ Version 1.5.0 (unreleased)
|
|||
[feat-exp-1-5]: https://tspiteri.gitlab.io/fixed/dev/fixed/#experimental-optional-features
|
||||
[issue 25]: https://gitlab.com/tspiteri/fixed/-/issues/25
|
||||
[tfof-1-5]: https://tspiteri.gitlab.io/fixed/dev/fixed/traits/trait.FixedOptionalFeatures.html
|
||||
[unw-1-5]: https://tspiteri.gitlab.io/fixed/dev/fixed/struct.Unwrapped.html
|
||||
|
||||
Version 1.4.0 (2020-10-22)
|
||||
==========================
|
||||
|
|
16
src/lib.rs
16
src/lib.rs
|
@ -205,17 +205,12 @@ removed. The removal of experimental features would however require a
|
|||
minor version bump. Similarly, on a minor version bump, optional
|
||||
dependencies can be updated to an incompatible newer version.
|
||||
|
||||
There are three experimental feature:
|
||||
There is one experimental feature:
|
||||
|
||||
1. `num-traits`, disabled by default. This implements some traits
|
||||
from the [*num-traits* crate]. (The plan is to upgrade this to an
|
||||
optional feature once *num-traits* reaches version 1.0.0.)
|
||||
2. `unwrapped`, disabled by default. This adds methods for arithmetic
|
||||
that panic on overflow even when debug assertions are disabled,
|
||||
similar to how wrapping methods will wrap even when debug
|
||||
assertions are enabled. (The plan is to always enable this
|
||||
functionality but remove the experimental feature in version
|
||||
1.5.0.)
|
||||
optional feature once the [*num-traits* crate] reaches version
|
||||
1.0.0.)
|
||||
|
||||
## License
|
||||
|
||||
|
@ -316,15 +311,12 @@ mod log10;
|
|||
mod serdeize;
|
||||
pub mod traits;
|
||||
pub mod types;
|
||||
#[cfg(feature = "unwrapped")]
|
||||
mod unwrapped;
|
||||
mod wide_div;
|
||||
mod wrapping;
|
||||
|
||||
#[cfg(feature = "num-traits")]
|
||||
pub use crate::impl_num_traits::RadixParseFixedError;
|
||||
#[cfg(feature = "unwrapped")]
|
||||
pub use crate::unwrapped::Unwrapped;
|
||||
use crate::{
|
||||
arith::MulDivOverflow,
|
||||
from_str::FromStrRadix,
|
||||
|
@ -336,7 +328,7 @@ use crate::{
|
|||
U62, U63, U64, U7, U8,
|
||||
},
|
||||
};
|
||||
pub use crate::{from_str::ParseFixedError, wrapping::Wrapping};
|
||||
pub use crate::{from_str::ParseFixedError, unwrapped::Unwrapped, wrapping::Wrapping};
|
||||
use core::{
|
||||
cmp::Ordering,
|
||||
hash::{Hash, Hasher},
|
||||
|
|
|
@ -1080,7 +1080,6 @@ assert_eq!(Fix::from_num(-7.5).wrapping_rem_euclid_int(20), Fix::from_num(-3.5))
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
if_signed! {
|
||||
$Signedness;
|
||||
comment! {
|
||||
|
@ -1093,9 +1092,6 @@ Overflow can only occur
|
|||
* if the value is negative and the fixed-point number has zero
|
||||
integer bits, such that it cannot hold the value −1.
|
||||
|
||||
This method is only available when the [`unwrapped` experimental
|
||||
feature][exp] is enabled.
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if the result does not fit.
|
||||
|
@ -1117,8 +1113,6 @@ use fixed::{types::extra::U", $s_nbits_m1, ", ", $s_fixed, "};
|
|||
type OneIntBit = ", $s_fixed, "<U", $s_nbits_m1, ">;
|
||||
let _overflow = OneIntBit::from_num(0.5).unwrapped_signum();
|
||||
```
|
||||
|
||||
[exp]: index.html#experimental-optional-features
|
||||
";
|
||||
#[inline]
|
||||
pub fn unwrapped_signum(self) -> $Fixed<Frac> {
|
||||
|
@ -1127,13 +1121,9 @@ let _overflow = OneIntBit::from_num(0.5).unwrapped_signum();
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
comment! {
|
||||
"Unwrapped multiplication. Returns the product, panicking on overflow.
|
||||
|
||||
This method is only available when the [`unwrapped` experimental
|
||||
feature][exp] is enabled.
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if the result does not fit.
|
||||
|
@ -1153,8 +1143,6 @@ use fixed::{types::extra::U4, ", $s_fixed, "};
|
|||
type Fix = ", $s_fixed, "<U4>;
|
||||
let _overflow = Fix::MAX.unwrapped_mul(Fix::from_num(4));
|
||||
```
|
||||
|
||||
[exp]: index.html#experimental-optional-features
|
||||
";
|
||||
#[inline]
|
||||
pub fn unwrapped_mul(self, rhs: $Fixed<Frac>) -> $Fixed<Frac> {
|
||||
|
@ -1162,13 +1150,9 @@ let _overflow = Fix::MAX.unwrapped_mul(Fix::from_num(4));
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
comment! {
|
||||
"Unwrapped division. Returns the quotient, panicking on overflow.
|
||||
|
||||
This method is only available when the [`unwrapped` experimental
|
||||
feature][exp] is enabled.
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if the divisor is zero or if the division results in overflow.
|
||||
|
@ -1190,8 +1174,6 @@ type Fix = ", $s_fixed, "<U4>;
|
|||
let quarter = Fix::from_num(1) / 4;
|
||||
let _overflow = Fix::MAX.unwrapped_div(quarter);
|
||||
```
|
||||
|
||||
[exp]: index.html#experimental-optional-features
|
||||
";
|
||||
#[inline]
|
||||
pub fn unwrapped_div(self, rhs: $Fixed<Frac>) -> $Fixed<Frac> {
|
||||
|
@ -1202,7 +1184,6 @@ let _overflow = Fix::MAX.unwrapped_div(quarter);
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
comment! {
|
||||
"Unwrapped reciprocal. Returns the reciprocal,
|
||||
panicking on overflow.
|
||||
|
@ -1228,13 +1209,9 @@ assert_eq!(Fix::from_num(0.25).unwrapped_recip(), Fix::from_num(4));
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
comment! {
|
||||
"Unwrapped Euclidean division. Returns the quotient, panicking on overflow.
|
||||
|
||||
This method is only available when the [`unwrapped` experimental
|
||||
feature][exp] is enabled.
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if the divisor is zero or if the division results in overflow.
|
||||
|
@ -1254,8 +1231,6 @@ use fixed::{types::extra::U4, ", $s_fixed, "};
|
|||
type Fix = ", $s_fixed, "<U4>;
|
||||
let _overflow = Fix::MAX.unwrapped_div_euclid(Fix::from_num(0.25));
|
||||
```
|
||||
|
||||
[exp]: index.html#experimental-optional-features
|
||||
";
|
||||
#[inline]
|
||||
pub fn unwrapped_div_euclid(self, rhs: $Fixed<Frac>) -> $Fixed<Frac> {
|
||||
|
@ -1266,7 +1241,6 @@ let _overflow = Fix::MAX.unwrapped_div_euclid(Fix::from_num(0.25));
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
comment! {
|
||||
"Unwrapped Euclidean division by an integer. Returns the quotient",
|
||||
if_signed_unsigned! {
|
||||
|
@ -1280,9 +1254,6 @@ Can never overflow for unsigned values.",
|
|||
},
|
||||
"
|
||||
|
||||
This method is only available when the [`unwrapped` experimental
|
||||
feature][exp] is enabled.
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if the divisor is zero",
|
||||
|
@ -1313,8 +1284,6 @@ let _overflow = Fix::MIN.unwrapped_div_euclid_int(-1);
|
|||
",
|
||||
},
|
||||
"```
|
||||
|
||||
[exp]: index.html#experimental-optional-features
|
||||
";
|
||||
#[inline]
|
||||
pub fn unwrapped_div_euclid_int(self, rhs: $Inner) -> $Fixed<Frac> {
|
||||
|
@ -1325,7 +1294,6 @@ let _overflow = Fix::MIN.unwrapped_div_euclid_int(-1);
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
comment! {
|
||||
"Unwrapped remainder for Euclidean division by an integer. Returns the remainder",
|
||||
if_signed_unsigned! {
|
||||
|
@ -1371,8 +1339,6 @@ let _overflow = Fix::from_num(-7.5).unwrapped_rem_euclid_int(20);
|
|||
",
|
||||
},
|
||||
"```
|
||||
|
||||
[exp]: index.html#experimental-optional-features
|
||||
";
|
||||
#[inline]
|
||||
pub fn unwrapped_rem_euclid_int(self, rhs: $Inner) -> $Fixed<Frac> {
|
||||
|
|
|
@ -700,7 +700,6 @@ assert_eq!(one_point_625.wrapping_to_num::<f32>(), 1.625f32);
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
comment! {
|
||||
"Creates a fixed-point number from another number,
|
||||
panicking on overflow.
|
||||
|
@ -718,9 +717,6 @@ The other number can be:
|
|||
rounding to even.
|
||||
* Any other number `src` for which [`ToFixed`] is implemented.
|
||||
|
||||
This method is only available when the [`unwrapped` experimental
|
||||
feature][exp] is enabled.
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if the value does not fit.
|
||||
|
@ -771,7 +767,6 @@ let _overflow = Fix::unwrapped_from_num(too_large);
|
|||
[`u64`]: https://doc.rust-lang.org/nightly/std/primitive.u64.html
|
||||
[`u8`]: https://doc.rust-lang.org/nightly/std/primitive.u8.html
|
||||
[`usize`]: https://doc.rust-lang.org/nightly/std/primitive.usize.html
|
||||
[exp]: index.html#experimental-optional-features
|
||||
[finite]: https://doc.rust-lang.org/nightly/std/primitive.f64.html#method.is_finite
|
||||
";
|
||||
#[inline]
|
||||
|
@ -783,7 +778,6 @@ let _overflow = Fix::unwrapped_from_num(too_large);
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
comment! {
|
||||
"Converts a fixed-point number to another number,
|
||||
panicking on overflow.
|
||||
|
@ -802,9 +796,6 @@ The other number can be:
|
|||
rounding to even.
|
||||
* Any other type `Dst` for which [`FromFixed`] is implemented.
|
||||
|
||||
This method is only available when the [`unwrapped` experimental
|
||||
feature][exp] is enabled.
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if the value does not fit.
|
||||
|
@ -854,7 +845,6 @@ let _overflow = Fix::MAX.unwrapped_to_num::<TooFewIntBits>();
|
|||
[`u64`]: https://doc.rust-lang.org/nightly/std/primitive.u64.html
|
||||
[`u8`]: https://doc.rust-lang.org/nightly/std/primitive.u8.html
|
||||
[`usize`]: https://doc.rust-lang.org/nightly/std/primitive.usize.html
|
||||
[exp]: index.html#experimental-optional-features
|
||||
";
|
||||
#[inline]
|
||||
pub fn unwrapped_to_num<Dst: FromFixed>(self) -> Dst {
|
||||
|
|
|
@ -1488,7 +1488,6 @@ assert_eq!(Fix::MAX.wrapping_next_power_of_two(), 0);
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
comment! {
|
||||
"Unwrapped negation. Returns the negated value, panicking on overflow.
|
||||
|
||||
|
@ -1500,9 +1499,6 @@ assert_eq!(Fix::MAX.wrapping_next_power_of_two(), 0);
|
|||
},
|
||||
"
|
||||
|
||||
This method is only available when the [`unwrapped` experimental
|
||||
feature][exp] is enabled.
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if the result does not fit.
|
||||
|
@ -1540,8 +1536,6 @@ let _overflow = Fix::from_num(5).unwrapped_neg();",
|
|||
},
|
||||
"
|
||||
```
|
||||
|
||||
[exp]: index.html#experimental-optional-features
|
||||
";
|
||||
#[inline]
|
||||
pub fn unwrapped_neg(self) -> $Fixed<Frac> {
|
||||
|
@ -1549,13 +1543,9 @@ let _overflow = Fix::from_num(5).unwrapped_neg();",
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
comment! {
|
||||
"Unwrapped addition. Returns the sum, panicking on overflow.
|
||||
|
||||
This method is only available when the [`unwrapped` experimental
|
||||
feature][exp] is enabled.
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if the result does not fit.
|
||||
|
@ -1575,8 +1565,6 @@ use fixed::{types::extra::U4, ", $s_fixed, "};
|
|||
type Fix = ", $s_fixed, "<U4>;
|
||||
let _overflow = Fix::MAX.unwrapped_add(Fix::from_bits(1));
|
||||
```
|
||||
|
||||
[exp]: index.html#experimental-optional-features
|
||||
";
|
||||
#[inline]
|
||||
pub fn unwrapped_add(self, rhs: $Fixed<Frac>) -> $Fixed<Frac> {
|
||||
|
@ -1584,13 +1572,9 @@ let _overflow = Fix::MAX.unwrapped_add(Fix::from_bits(1));
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
comment! {
|
||||
"Unwrapped subtraction. Returns the difference, panicking on overflow.
|
||||
|
||||
This method is only available when the [`unwrapped` experimental
|
||||
feature][exp] is enabled.
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if the result does not fit.
|
||||
|
@ -1617,8 +1601,6 @@ use fixed::{types::extra::U4, ", $s_fixed, "};
|
|||
type Fix = ", $s_fixed, "<U4>;
|
||||
let _overflow = Fix::MIN.unwrapped_sub(Fix::from_bits(1));
|
||||
```
|
||||
|
||||
[exp]: index.html#experimental-optional-features
|
||||
";
|
||||
#[inline]
|
||||
pub fn unwrapped_sub(self, rhs: $Fixed<Frac>) -> $Fixed<Frac> {
|
||||
|
@ -1626,7 +1608,6 @@ let _overflow = Fix::MIN.unwrapped_sub(Fix::from_bits(1));
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
comment! {
|
||||
"Unwrapped multiply and add.
|
||||
Returns `self` × `mul` + `add`, panicking on overflow.
|
||||
|
@ -1644,9 +1625,6 @@ correct result.
|
|||
"The `mul` parameter can have a fixed-point type like
|
||||
`self` but with a different number of fractional bits.
|
||||
|
||||
This method is only available when the [`unwrapped` experimental
|
||||
feature][exp] is enabled.
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if the result does not fit.
|
||||
|
@ -1676,8 +1654,6 @@ use fixed::{types::extra::U4, ", $s_fixed, "};
|
|||
type Fix = ", $s_fixed, "<U4>;
|
||||
let _overflow = Fix::MAX.unwrapped_mul_add(Fix::from_num(1), Fix::from_bits(1));
|
||||
```
|
||||
|
||||
[exp]: index.html#experimental-optional-features
|
||||
";
|
||||
#[inline]
|
||||
pub fn unwrapped_mul_add<MulFrac: $LeEqU>(
|
||||
|
@ -1689,13 +1665,9 @@ let _overflow = Fix::MAX.unwrapped_mul_add(Fix::from_num(1), Fix::from_bits(1));
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
comment! {
|
||||
"Unwrapped multiplication by an integer. Returns the product, panicking on overflow.
|
||||
|
||||
This method is only available when the [`unwrapped` experimental
|
||||
feature][exp] is enabled.
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if the result does not fit.
|
||||
|
@ -1715,8 +1687,6 @@ use fixed::{types::extra::U4, ", $s_fixed, "};
|
|||
type Fix = ", $s_fixed, "<U4>;
|
||||
let _overflow = Fix::MAX.unwrapped_mul_int(4);
|
||||
```
|
||||
|
||||
[exp]: index.html#experimental-optional-features
|
||||
";
|
||||
#[inline]
|
||||
pub fn unwrapped_mul_int(self, rhs: $Inner) -> $Fixed<Frac> {
|
||||
|
@ -1724,7 +1694,6 @@ let _overflow = Fix::MAX.unwrapped_mul_int(4);
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
comment! {
|
||||
"Unwrapped division by an integer. Returns the quotient",
|
||||
if_signed_unsigned! {
|
||||
|
@ -1738,9 +1707,6 @@ Can never overflow for unsigned values.",
|
|||
},
|
||||
"
|
||||
|
||||
This method is only available when the [`unwrapped` experimental
|
||||
feature][exp] is enabled.
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if the divisor is zero",
|
||||
|
@ -1772,8 +1738,6 @@ let _overflow = Fix::MIN.unwrapped_div_int(-1);
|
|||
",
|
||||
},
|
||||
"```
|
||||
|
||||
[exp]: index.html#experimental-optional-features
|
||||
";
|
||||
#[inline]
|
||||
pub fn unwrapped_div_int(self, rhs: $Inner) -> $Fixed<Frac> {
|
||||
|
@ -1784,13 +1748,9 @@ let _overflow = Fix::MIN.unwrapped_div_int(-1);
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
comment! {
|
||||
"Unwrapped shift left. Panics if `rhs` ≥ ", $s_nbits, ".
|
||||
|
||||
This method is only available when the [`unwrapped` experimental
|
||||
feature][exp] is enabled.
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if `rhs` ≥ ", $s_nbits, ".
|
||||
|
@ -1810,8 +1770,6 @@ use fixed::{types::extra::U4, ", $s_fixed, "};
|
|||
type Fix = ", $s_fixed, "<U4>;
|
||||
let _overflow = Fix::from_num(1).unwrapped_shl(", $s_nbits, ");
|
||||
```
|
||||
|
||||
[exp]: index.html#experimental-optional-features
|
||||
";
|
||||
#[inline]
|
||||
pub fn unwrapped_shl(self, rhs: u32) -> $Fixed<Frac> {
|
||||
|
@ -1819,13 +1777,9 @@ let _overflow = Fix::from_num(1).unwrapped_shl(", $s_nbits, ");
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
comment! {
|
||||
"Unwrapped shift right. Panics if `rhs` ≥ ", $s_nbits, ".
|
||||
|
||||
This method is only available when the [`unwrapped` experimental
|
||||
feature][exp] is enabled.
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if `rhs` ≥ ", $s_nbits, ".
|
||||
|
@ -1845,8 +1799,6 @@ use fixed::{types::extra::U4, ", $s_fixed, "};
|
|||
type Fix = ", $s_fixed, "<U4>;
|
||||
let _overflow = Fix::from_num(1).unwrapped_shr(", $s_nbits, ");
|
||||
```
|
||||
|
||||
[exp]: index.html#experimental-optional-features
|
||||
";
|
||||
#[inline]
|
||||
pub fn unwrapped_shr(self, rhs: u32) -> $Fixed<Frac> {
|
||||
|
@ -1854,7 +1806,6 @@ let _overflow = Fix::from_num(1).unwrapped_shr(", $s_nbits, ");
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
if_signed! {
|
||||
$Signedness;
|
||||
comment! {
|
||||
|
@ -1862,9 +1813,6 @@ let _overflow = Fix::from_num(1).unwrapped_shr(", $s_nbits, ");
|
|||
|
||||
Overflow can only occur when trying to find the absolute value of the minimum value.
|
||||
|
||||
This method is only available when the [`unwrapped` experimental
|
||||
feature][exp] is enabled.
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if the result does not fit.
|
||||
|
@ -1884,8 +1832,6 @@ use fixed::{types::extra::U4, ", $s_fixed, "};
|
|||
type Fix = ", $s_fixed, "<U4>;
|
||||
let _overflow = Fix::MIN.unwrapped_abs();
|
||||
```
|
||||
|
||||
[exp]: index.html#experimental-optional-features
|
||||
";
|
||||
#[inline]
|
||||
pub fn unwrapped_abs(self) -> $Fixed<Frac> {
|
||||
|
@ -1900,9 +1846,6 @@ let _overflow = Fix::MIN.unwrapped_abs();
|
|||
"Returns the smallest power of two that is ≥ `self`,
|
||||
panicking if the next power of two is too large to represent.
|
||||
|
||||
This method is only available when the [`unwrapped` experimental
|
||||
feature][exp] is enabled.
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if the result does not fit.
|
||||
|
@ -1926,8 +1869,6 @@ use fixed::{types::extra::U4, ", $s_fixed, "};
|
|||
type Fix = ", $s_fixed, "<U4>;
|
||||
let _overflow = Fix::MAX.unwrapped_next_power_of_two();
|
||||
```
|
||||
|
||||
[exp]: index.html#experimental-optional-features
|
||||
";
|
||||
#[inline]
|
||||
pub fn unwrapped_next_power_of_two(self) -> $Fixed<Frac> {
|
||||
|
|
|
@ -679,14 +679,10 @@ assert_eq!(Fix::MAX.wrapping_round_ties_to_even(), Fix::MIN);
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
comment! {
|
||||
"Unwrapped ceil. Rounds to the next integer towards +∞,
|
||||
panicking on overflow.
|
||||
|
||||
This method is only available when the [`unwrapped` experimental
|
||||
feature][exp] is enabled.
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if the result does not fit.
|
||||
|
@ -712,8 +708,6 @@ use fixed::{types::extra::U4, ", $s_fixed, "};
|
|||
type Fix = ", $s_fixed, "<U4>;
|
||||
let _overflow = Fix::MAX.unwrapped_ceil();
|
||||
```
|
||||
|
||||
[exp]: index.html#experimental-optional-features
|
||||
";
|
||||
#[inline]
|
||||
pub fn unwrapped_ceil(self) -> $Fixed<Frac> {
|
||||
|
@ -721,7 +715,6 @@ let _overflow = Fix::MAX.unwrapped_ceil();
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
comment! {
|
||||
"Unwrapped floor. Rounds to the next integer towards −∞",
|
||||
if_signed_unsigned! {
|
||||
|
@ -737,9 +730,6 @@ Panics if the result does not fit.",
|
|||
},
|
||||
"
|
||||
|
||||
This method is only available when the [`unwrapped` experimental
|
||||
feature][exp] is enabled.
|
||||
|
||||
# Examples
|
||||
|
||||
```rust
|
||||
|
@ -761,8 +751,6 @@ let _overflow = AllFrac::MIN.unwrapped_floor();
|
|||
",
|
||||
},
|
||||
"```
|
||||
|
||||
[exp]: index.html#experimental-optional-features
|
||||
";
|
||||
#[inline]
|
||||
pub fn unwrapped_floor(self) -> $Fixed<Frac> {
|
||||
|
@ -770,14 +758,10 @@ let _overflow = AllFrac::MIN.unwrapped_floor();
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
comment! {
|
||||
"Unwrapped round. Rounds to the next integer to the
|
||||
nearest, with ties rounded away from zero, and panicking on overflow.
|
||||
|
||||
This method is only available when the [`unwrapped` experimental
|
||||
feature][exp] is enabled.
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if the result does not fit.
|
||||
|
@ -803,8 +787,6 @@ use fixed::{types::extra::U4, ", $s_fixed, "};
|
|||
type Fix = ", $s_fixed, "<U4>;
|
||||
let _overflow = Fix::MAX.unwrapped_round();
|
||||
```
|
||||
|
||||
[exp]: index.html#experimental-optional-features
|
||||
";
|
||||
#[inline]
|
||||
pub fn unwrapped_round(self) -> $Fixed<Frac> {
|
||||
|
@ -812,14 +794,10 @@ let _overflow = Fix::MAX.unwrapped_round();
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
comment! {
|
||||
"Unwrapped round. Rounds to the next integer to the
|
||||
nearest, with ties rounded to even, and panicking on overflow.
|
||||
|
||||
This method is only available when the [`unwrapped` experimental
|
||||
feature][exp] is enabled.
|
||||
|
||||
# Panics
|
||||
|
||||
Panics if the result does not fit.
|
||||
|
@ -840,8 +818,6 @@ use fixed::{types::extra::U4, ", $s_fixed, "};
|
|||
type Fix = ", $s_fixed, "<U4>;
|
||||
let _overflow = Fix::MAX.unwrapped_round_ties_to_even();
|
||||
```
|
||||
|
||||
[exp]: index.html#experimental-optional-features
|
||||
";
|
||||
#[inline]
|
||||
pub fn unwrapped_round_ties_to_even(self) -> $Fixed<Frac> {
|
||||
|
|
|
@ -13,12 +13,10 @@
|
|||
// <https://www.apache.org/licenses/LICENSE-2.0> and
|
||||
// <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
use crate::Unwrapped;
|
||||
use crate::{
|
||||
types::extra::{LeEqU128, LeEqU16, LeEqU32, LeEqU64, LeEqU8},
|
||||
FixedI128, FixedI16, FixedI32, FixedI64, FixedI8, FixedU128, FixedU16, FixedU32, FixedU64,
|
||||
FixedU8, Wrapping,
|
||||
FixedU8, Unwrapped, Wrapping,
|
||||
};
|
||||
use serde::{
|
||||
de::{Deserialize, Deserializer, Error as DeError},
|
||||
|
@ -60,7 +58,6 @@ macro_rules! serde_fixed {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
impl<Frac: $LeEqU> Serialize for Unwrapped<$Fixed<Frac>> {
|
||||
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
||||
self.0.serialize(serializer)
|
||||
|
@ -126,7 +123,6 @@ macro_rules! serde_fixed {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
impl<'de, Frac: $LeEqU> Deserialize<'de> for Unwrapped<$Fixed<Frac>> {
|
||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||
$Fixed::deserialize(deserializer).map(Unwrapped)
|
||||
|
|
151
src/traits.rs
151
src/traits.rs
|
@ -510,7 +510,6 @@ where
|
|||
/// [`wrapping_from_fixed`]: trait.FromFixed.html#tymethod.wrapping_from_fixed
|
||||
fn wrapping_to_num<Dst: FromFixed>(self) -> Dst;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Creates a fixed-point number from another number, panicking on overflow.
|
||||
///
|
||||
/// # Panics
|
||||
|
@ -518,7 +517,6 @@ where
|
|||
/// Panics if the value does not fit.
|
||||
fn unwrapped_from_num<Src: ToFixed>(src: Src) -> Self;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Converts a fixed-point number to another number, panicking on overflow.
|
||||
///
|
||||
/// # Panics
|
||||
|
@ -732,60 +730,36 @@ where
|
|||
/// with ties rounded to even, and wrapping on overflow.
|
||||
fn wrapping_round_ties_to_even(self) -> Self;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Unwrapped ceil. Rounds to the next integer towards +∞,
|
||||
/// panicking on overflow.
|
||||
///
|
||||
/// This method is only available when the [`unwrapped`
|
||||
/// experimental feature][exp] is enabled.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the result does not fit.
|
||||
///
|
||||
/// [exp]: ../index.html#experimental-optional-features
|
||||
fn unwrapped_ceil(self) -> Self;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Unwrapped floor. Rounds to the next integer towards −∞,
|
||||
/// panicking on overflow.
|
||||
///
|
||||
/// This method is only available when the [`unwrapped`
|
||||
/// experimental feature][exp] is enabled.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the result does not fit.
|
||||
///
|
||||
/// [exp]: ../index.html#experimental-optional-features
|
||||
fn unwrapped_floor(self) -> Self;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Unwrapped round. Rounds to the next integer to the nearest,
|
||||
/// with ties rounded away from zero, and panicking on overflow.
|
||||
///
|
||||
/// This method is only available when the [`unwrapped`
|
||||
/// experimental feature][exp] is enabled.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the result does not fit.
|
||||
///
|
||||
/// [exp]: ../index.html#experimental-optional-features
|
||||
fn unwrapped_round(self) -> Self;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Unwrapped round. Rounds to the next integer to the nearest,
|
||||
/// with ties rounded to even, and panicking on overflow.
|
||||
///
|
||||
/// This method is only available when the [`unwrapped`
|
||||
/// experimental feature][exp] is enabled.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the result does not fit.
|
||||
///
|
||||
/// [exp]: ../index.html#experimental-optional-features
|
||||
fn unwrapped_round_ties_to_even(self) -> Self;
|
||||
|
||||
/// Overflowing ceil. Rounds to the next integer towards +∞.
|
||||
|
@ -1140,192 +1114,108 @@ where
|
|||
/// bits, then shifts and returns the number.
|
||||
fn wrapping_shr(self, rhs: u32) -> Self;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Unwrapped negation. Returns the negated value, panicking on overflow.
|
||||
///
|
||||
/// This method is only available when the [`unwrapped`
|
||||
/// experimental feature][exp] is enabled.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the result does not fit.
|
||||
///
|
||||
/// [exp]: ../index.html#experimental-optional-features
|
||||
fn unwrapped_neg(self) -> Self;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Unwrapped addition. Returns the sum, panicking on overflow.
|
||||
///
|
||||
/// This method is only available when the [`unwrapped`
|
||||
/// experimental feature][exp] is enabled.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the result does not fit.
|
||||
///
|
||||
/// [exp]: ../index.html#experimental-optional-features
|
||||
fn unwrapped_add(self, rhs: Self) -> Self;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Unwrapped subtraction. Returns the difference, panicking on overflow.
|
||||
///
|
||||
/// This method is only available when the [`unwrapped`
|
||||
/// experimental feature][exp] is enabled.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the result does not fit.
|
||||
///
|
||||
/// [exp]: ../index.html#experimental-optional-features
|
||||
fn unwrapped_sub(self, rhs: Self) -> Self;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Unwrapped multiplication. Returns the product, panicking on overflow.
|
||||
///
|
||||
/// This method is only available when the [`unwrapped`
|
||||
/// experimental feature][exp] is enabled.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the result does not fit.
|
||||
///
|
||||
/// [exp]: ../index.html#experimental-optional-features
|
||||
fn unwrapped_mul(self, rhs: Self) -> Self;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Unwrapped division. Returns the quotient, panicking on overflow.
|
||||
///
|
||||
/// This method is only available when the [`unwrapped`
|
||||
/// experimental feature][exp] is enabled.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the divisor is zero or if the result does not fit.
|
||||
///
|
||||
/// [exp]: ../index.html#experimental-optional-features
|
||||
fn unwrapped_div(self, rhs: Self) -> Self;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Unwrapped reciprocal. Returns reciprocal, panicking on overflow.
|
||||
///
|
||||
/// This method is only available when the [`unwrapped`
|
||||
/// experimental feature][exp] is enabled.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if `self` is zero or on overflow.
|
||||
///
|
||||
/// [exp]: ../index.html#experimental-optional-features
|
||||
fn unwrapped_recip(self) -> Self;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Unwrapped multiply and add. Returns `self` × `mul` + `add`, panicking on overflow.
|
||||
///
|
||||
/// This method is only available when the [`unwrapped`
|
||||
/// experimental feature][exp] is enabled.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the result does not fit.
|
||||
///
|
||||
/// [exp]: ../index.html#experimental-optional-features
|
||||
fn unwrapped_mul_add(self, mul: Self, add: Self) -> Self;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Unwrapped Euclidean division. Returns the quotient, panicking on overflow.
|
||||
///
|
||||
/// This method is only available when the [`unwrapped`
|
||||
/// experimental feature][exp] is enabled.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the divisor is zero or if the result does not fit.
|
||||
///
|
||||
/// [exp]: ../index.html#experimental-optional-features
|
||||
fn unwrapped_div_euclid(self, rhs: Self) -> Self;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Unwrapped multiplication by an integer. Returns the product, panicking on overflow.
|
||||
///
|
||||
/// This method is only available when the [`unwrapped`
|
||||
/// experimental feature][exp] is enabled.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the result does not fit.
|
||||
///
|
||||
/// [exp]: ../index.html#experimental-optional-features
|
||||
fn unwrapped_mul_int(self, rhs: Self::Bits) -> Self;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Unwrapped division by an integer. Returns the quotient, panicking on overflow.
|
||||
///
|
||||
/// Overflow can only occur when dividing the minimum value by −1.
|
||||
///
|
||||
/// This method is only available when the [`unwrapped`
|
||||
/// experimental feature][exp] is enabled.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the divisor is zero or if the result does not fit.
|
||||
///
|
||||
/// [exp]: ../index.html#experimental-optional-features
|
||||
fn unwrapped_div_int(self, rhs: Self::Bits) -> Self;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Unwrapped Euclidean division by an integer. Returns the
|
||||
/// quotient, panicking on overflow.
|
||||
///
|
||||
/// Overflow can only occur when dividing the minimum value by −1.
|
||||
///
|
||||
/// This method is only available when the [`unwrapped`
|
||||
/// experimental feature][exp] is enabled.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the divisor is zero or if the result does not fit.
|
||||
///
|
||||
/// [exp]: ../index.html#experimental-optional-features
|
||||
fn unwrapped_div_euclid_int(self, rhs: Self::Bits) -> Self;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Unwrapped remainder for Euclidean division by an integer.
|
||||
/// Returns the remainder, panicking on overflow.
|
||||
///
|
||||
/// This method is only available when the [`unwrapped`
|
||||
/// experimental feature][exp] is enabled.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the divisor is zero or if the result does not fit.
|
||||
///
|
||||
/// [exp]: ../index.html#experimental-optional-features
|
||||
fn unwrapped_rem_euclid_int(self, rhs: Self::Bits) -> Self;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Unwrapped shift left. Panics if `rhs` ≥ the number of bits.
|
||||
///
|
||||
/// This method is only available when the [`unwrapped`
|
||||
/// experimental feature][exp] is enabled.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if `rhs` ≥ the number of bits.
|
||||
///
|
||||
/// [exp]: ../index.html#experimental-optional-features
|
||||
fn unwrapped_shl(self, rhs: u32) -> Self;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Unwrapped shift right. Panics if `rhs` ≥ the number of bits.
|
||||
///
|
||||
/// This method is only available when the [`unwrapped`
|
||||
/// experimental feature][exp] is enabled.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if `rhs` ≥ the number of bits.
|
||||
///
|
||||
/// [exp]: ../index.html#experimental-optional-features
|
||||
fn unwrapped_shr(self, rhs: u32) -> Self;
|
||||
|
||||
/// Overflowing negation.
|
||||
|
@ -1588,22 +1478,15 @@ pub trait FixedSigned: Fixed + Neg<Output = Self> {
|
|||
/// integer bits, such that it cannot hold the value −1.
|
||||
fn wrapping_signum(self) -> Self;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Unwrapped absolute value. Returns the absolute value, panicking on overflow.
|
||||
///
|
||||
/// Overflow can only occur when trying to find the absolute value of the minimum value.
|
||||
///
|
||||
/// This method is only available when the [`unwrapped`
|
||||
/// experimental feature][exp] is enabled.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the result does not fit.
|
||||
///
|
||||
/// [exp]: ../index.html#experimental-optional-features
|
||||
fn unwrapped_abs(self) -> Self;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Unwrapped signum. Returns a number representing the sign of
|
||||
/// `self`, panicking on overflow.
|
||||
///
|
||||
|
@ -1613,14 +1496,9 @@ pub trait FixedSigned: Fixed + Neg<Output = Self> {
|
|||
/// * if the value is negative and the fixed-point number has zero
|
||||
/// integer bits, such that it cannot hold the value −1.
|
||||
///
|
||||
/// This method is only available when the [`unwrapped`
|
||||
/// experimental feature][exp] is enabled.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the result does not fit.
|
||||
///
|
||||
/// [exp]: ../index.html#experimental-optional-features
|
||||
fn unwrapped_signum(self) -> Self;
|
||||
|
||||
/// Overflowing absolute value.
|
||||
|
@ -1685,18 +1563,12 @@ pub trait FixedUnsigned: Fixed {
|
|||
/// to 0 if the next power of two is too large to represent.
|
||||
fn wrapping_next_power_of_two(self) -> Self;
|
||||
|
||||
#[cfg(feature = "unwrapped")]
|
||||
/// Returns the smallest power of two that is ≥ `self`, panicking
|
||||
/// if the next power of two is too large to represent.
|
||||
///
|
||||
/// This method is only available when the [`unwrapped`
|
||||
/// experimental feature][exp] is enabled.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the result does not fit.
|
||||
///
|
||||
/// [exp]: ../index.html#experimental-optional-features
|
||||
fn unwrapped_next_power_of_two(self) -> Self;
|
||||
}
|
||||
|
||||
|
@ -2413,9 +2285,7 @@ macro_rules! impl_fixed {
|
|||
trait_delegate! { fn saturating_to_num<Dst: FromFixed>(self) -> Dst }
|
||||
trait_delegate! { fn wrapping_from_num<Src: ToFixed>(val: Src) -> Self }
|
||||
trait_delegate! { fn wrapping_to_num<Dst: FromFixed>(self) -> Dst }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_from_num<Src: ToFixed>(val: Src) -> Self }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_to_num<Dst: FromFixed>(self) -> Dst }
|
||||
trait_delegate! { fn overflowing_from_num<Src: ToFixed>(val: Src) -> (Self, bool) }
|
||||
trait_delegate! { fn overflowing_to_num<Dst: FromFixed>(self) -> (Dst, bool) }
|
||||
|
@ -2477,13 +2347,9 @@ macro_rules! impl_fixed {
|
|||
trait_delegate! { fn wrapping_floor(self) -> Self }
|
||||
trait_delegate! { fn wrapping_round(self) -> Self }
|
||||
trait_delegate! { fn wrapping_round_ties_to_even(self) -> Self }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_ceil(self) -> Self }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_floor(self) -> Self }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_round(self) -> Self }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_round_ties_to_even(self) -> Self }
|
||||
trait_delegate! { fn overflowing_ceil(self) -> (Self, bool) }
|
||||
trait_delegate! { fn overflowing_floor(self) -> (Self, bool) }
|
||||
|
@ -2547,33 +2413,19 @@ macro_rules! impl_fixed {
|
|||
trait_delegate! { fn wrapping_rem_euclid_int(self, rhs: Self::Bits) -> Self }
|
||||
trait_delegate! { fn wrapping_shl(self, rhs: u32) -> Self }
|
||||
trait_delegate! { fn wrapping_shr(self, rhs: u32) -> Self }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_neg(self) -> Self }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_add(self, rhs: Self) -> Self }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_sub(self, rhs: Self) -> Self }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_mul(self, rhs: Self) -> Self }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_div(self, rhs: Self) -> Self }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_recip(self) -> Self }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_mul_add(self, mul: Self, add: Self) -> Self }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_div_euclid(self, rhs: Self) -> Self }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_mul_int(self, rhs: Self::Bits) -> Self }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_div_int(self, rhs: Self::Bits) -> Self }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_div_euclid_int(self, rhs: Self::Bits) -> Self }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_rem_euclid_int(self, rhs: Self::Bits) -> Self }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_shl(self, rhs: u32) -> Self }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_shr(self, rhs: u32) -> Self }
|
||||
trait_delegate! { fn overflowing_neg(self) -> (Self, bool) }
|
||||
trait_delegate! { fn overflowing_add(self, rhs: Self) -> (Self, bool) }
|
||||
|
@ -2754,9 +2606,7 @@ macro_rules! impl_fixed {
|
|||
trait_delegate! { fn saturating_signum(self) -> Self }
|
||||
trait_delegate! { fn wrapping_abs(self) -> Self }
|
||||
trait_delegate! { fn wrapping_signum(self) -> Self }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_abs(self) -> Self }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_signum(self) -> Self }
|
||||
trait_delegate! { fn overflowing_abs(self) -> (Self, bool) }
|
||||
trait_delegate! { fn overflowing_signum(self) -> (Self, bool) }
|
||||
|
@ -2772,7 +2622,6 @@ macro_rules! impl_fixed {
|
|||
trait_delegate! { fn next_power_of_two(self) -> Self }
|
||||
trait_delegate! { fn checked_next_power_of_two(self) -> Option<Self> }
|
||||
trait_delegate! { fn wrapping_next_power_of_two(self) -> Self }
|
||||
#[cfg(feature = "unwrapped")]
|
||||
trait_delegate! { fn unwrapped_next_power_of_two(self) -> Self }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,9 +39,6 @@ use core::{
|
|||
///
|
||||
/// The underlying value can be retrieved through the `.0` index.
|
||||
///
|
||||
/// This struct is only available when the [`unwrapped` experimental
|
||||
/// feature][exp] is enabled.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// This panics even when debug assertions are disabled.
|
||||
|
@ -52,8 +49,6 @@ use core::{
|
|||
/// let delta = Unwrapped(I16F16::from_bits(1));
|
||||
/// let _overflow = max + delta;
|
||||
/// ```
|
||||
///
|
||||
/// [exp]: index.html#experimental-optional-features
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, Copy, Default, Hash, Debug, Eq, PartialEq, Ord, PartialOrd)]
|
||||
pub struct Unwrapped<F>(pub F);
|
||||
|
|
Loading…
Reference in New Issue