Initial vendor packages
Signed-off-by: Valentin Popov <valentin@popov.link>
This commit is contained in:
1
vendor/num-rational/.cargo-checksum.json
vendored
Normal file
1
vendor/num-rational/.cargo-checksum.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"files":{"Cargo.toml":"9951a0d2a04403a009b2b07953b430ece2b2ca44c44b1c5b2b566ba162cac951","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"61154a19b71dd682b1955273e602e687d0cfc152afcfdf9fc9ee11beb083704a","RELEASES.md":"8e4d5cb5d36225b298f1412204d342858e6b7cc4bf4d39b53b48dd1be1c5083a","build.rs":"43a2d0ec88488d561f7b367d83f8cce81ad68bdfd352a3db9c881574a734c44f","src/lib.rs":"43762876ac4587ca6f553c029e69d3228f70c611fd7a1a8f0d4ea7859d9939e1","src/pow.rs":"c38cabc61e75e99425ee4fea7ac5b0712a648baa0635a2c40a6215edd43ae4a3"},"package":"0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0"}
|
79
vendor/num-rational/Cargo.toml
vendored
Normal file
79
vendor/num-rational/Cargo.toml
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
||||
#
|
||||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g., crates.io) dependencies.
|
||||
#
|
||||
# If you are reading this file be aware that the original Cargo.toml
|
||||
# will likely look very different (and much more reasonable).
|
||||
# See Cargo.toml.orig for the original contents.
|
||||
|
||||
[package]
|
||||
edition = "2018"
|
||||
name = "num-rational"
|
||||
version = "0.4.1"
|
||||
authors = ["The Rust Project Developers"]
|
||||
exclude = [
|
||||
"/bors.toml",
|
||||
"/ci/*",
|
||||
"/.github/*",
|
||||
]
|
||||
description = "Rational numbers implementation for Rust"
|
||||
homepage = "https://github.com/rust-num/num-rational"
|
||||
documentation = "https://docs.rs/num-rational"
|
||||
readme = "README.md"
|
||||
keywords = [
|
||||
"mathematics",
|
||||
"numerics",
|
||||
"fractions",
|
||||
]
|
||||
categories = [
|
||||
"algorithms",
|
||||
"data-structures",
|
||||
"science",
|
||||
"no-std",
|
||||
]
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/rust-num/num-rational"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
features = [
|
||||
"std",
|
||||
"num-bigint-std",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[dependencies.num-bigint]
|
||||
version = "0.4.0"
|
||||
optional = true
|
||||
default-features = false
|
||||
|
||||
[dependencies.num-integer]
|
||||
version = "0.1.42"
|
||||
features = ["i128"]
|
||||
default-features = false
|
||||
|
||||
[dependencies.num-traits]
|
||||
version = "0.2.11"
|
||||
features = ["i128"]
|
||||
default-features = false
|
||||
|
||||
[dependencies.serde]
|
||||
version = "1.0.0"
|
||||
optional = true
|
||||
default-features = false
|
||||
|
||||
[build-dependencies.autocfg]
|
||||
version = "1.0.0"
|
||||
|
||||
[features]
|
||||
default = [
|
||||
"num-bigint-std",
|
||||
"std",
|
||||
]
|
||||
num-bigint-std = ["num-bigint/std"]
|
||||
std = [
|
||||
"num-integer/std",
|
||||
"num-traits/std",
|
||||
]
|
201
vendor/num-rational/LICENSE-APACHE
vendored
Normal file
201
vendor/num-rational/LICENSE-APACHE
vendored
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
25
vendor/num-rational/LICENSE-MIT
vendored
Normal file
25
vendor/num-rational/LICENSE-MIT
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
Copyright (c) 2014 The Rust Project Developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
51
vendor/num-rational/README.md
vendored
Normal file
51
vendor/num-rational/README.md
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
# num-rational
|
||||
|
||||
[](https://crates.io/crates/num-rational)
|
||||
[](https://docs.rs/num-rational)
|
||||
[](https://rust-lang.github.io/rfcs/2495-min-rust-version.html)
|
||||
[](https://github.com/rust-num/num-rational/actions)
|
||||
|
||||
Generic `Rational` numbers (aka fractions) for Rust.
|
||||
|
||||
## Usage
|
||||
|
||||
Add this to your `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
num-rational = "0.4"
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
This crate can be used without the standard library (`#![no_std]`) by disabling
|
||||
the default `std` feature. Use this in `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
[dependencies.num-rational]
|
||||
version = "0.4"
|
||||
default-features = false
|
||||
```
|
||||
|
||||
## Releases
|
||||
|
||||
Release notes are available in [RELEASES.md](RELEASES.md).
|
||||
|
||||
## Compatibility
|
||||
|
||||
The `num-rational` crate is tested for rustc 1.31 and greater.
|
||||
|
||||
## License
|
||||
|
||||
Licensed under either of
|
||||
|
||||
* [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
||||
* [MIT license](http://opensource.org/licenses/MIT)
|
||||
|
||||
at your option.
|
||||
|
||||
### Contribution
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted
|
||||
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
|
||||
dual licensed as above, without any additional terms or conditions.
|
160
vendor/num-rational/RELEASES.md
vendored
Normal file
160
vendor/num-rational/RELEASES.md
vendored
Normal file
@ -0,0 +1,160 @@
|
||||
# Release 0.4.1 (2022-06-23)
|
||||
|
||||
- [Fewer `clone` calls are used when reducing a new `Ratio<T>`][98].
|
||||
- [Conversions to floating point are better at avoiding underflow][104].
|
||||
- [`Ratio<T>` now implements `Default`][105], returning a zero value.
|
||||
|
||||
**Contributors**: @cuviper, @lemmih, @MattX
|
||||
|
||||
[98]: https://github.com/rust-num/num-rational/pull/98
|
||||
[104]: https://github.com/rust-num/num-rational/pull/104
|
||||
[105]: https://github.com/rust-num/num-rational/pull/105
|
||||
|
||||
# Release 0.4.0 (2021-03-05)
|
||||
|
||||
- The optional `num-bigint` dependency is now 0.4.
|
||||
- [The `Rational` alias for `Ratio<usize>` is now deprecated][92]. It is
|
||||
recommended to use specific type sizes for numeric computation, like
|
||||
`Rational32` and `Rational64`.
|
||||
|
||||
**Contributors**: @cuviper, @vks
|
||||
|
||||
[92]: https://github.com/rust-num/num-rational/pull/92
|
||||
|
||||
# Release 0.3.2 (2020-11-06)
|
||||
|
||||
- [Fix always rebuilding with --remap-path-prefix][88]
|
||||
|
||||
**Contributors**: @Nemo157
|
||||
|
||||
[88]: https://github.com/rust-num/num-rational/pull/88
|
||||
|
||||
# Release 0.3.1 (2020-10-29)
|
||||
|
||||
- [Handle to_f64() with raw division by zero][83].
|
||||
- [Better document panic behaviour][84].
|
||||
- Clarify the license specification as "MIT OR Apache-2.0".
|
||||
|
||||
**Contributors**: @cuviper, @zetok
|
||||
|
||||
[83]: https://github.com/rust-num/num-rational/pull/83
|
||||
[84]: https://github.com/rust-num/num-rational/pull/84
|
||||
|
||||
# Release 0.3.0 (2020-06-13)
|
||||
|
||||
### Enhancements
|
||||
|
||||
- [`Ratio` now implements `ToPrimitive`][52].
|
||||
- [`Ratio` now implements additional formatting traits][56]:
|
||||
- `Binary`, `Octal`, `LowerHex`, `UpperHex`, `LowerExp`, `UpperExp`
|
||||
- [The `Pow` implementations have been expanded][70].
|
||||
- `Pow<BigInt>` and `Pow<BigUint>` are now implemented.
|
||||
- `Pow<_> for &Ratio<T>` now uses `&T: Pow`.
|
||||
- The inherent `pow` method now uses `&T: Pow`.
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
- [`num-rational` now requires Rust 1.31 or greater][66].
|
||||
- The "i128" opt-in feature was removed, now always available.
|
||||
- [The "num-bigint-std" feature replaces "bigint" with `std` enabled][80].
|
||||
- The "num-bigint" feature without `std` uses `alloc` on Rust 1.36+.
|
||||
|
||||
**Contributors**: @cuviper, @MattX, @maxbla
|
||||
|
||||
[52]: https://github.com/rust-num/num-rational/pull/52
|
||||
[56]: https://github.com/rust-num/num-rational/pull/56
|
||||
[66]: https://github.com/rust-num/num-rational/pull/66
|
||||
[70]: https://github.com/rust-num/num-rational/pull/70
|
||||
[80]: https://github.com/rust-num/num-rational/pull/80
|
||||
|
||||
# Release 0.2.4 (2020-03-17)
|
||||
|
||||
- [Fixed `CheckedDiv` when both dividend and divisor are 0][74].
|
||||
- [Fixed `CheckedDiv` with `min_value()` numerators][76].
|
||||
|
||||
[74]: https://github.com/rust-num/num-rational/pull/74
|
||||
[76]: https://github.com/rust-num/num-rational/pull/76
|
||||
|
||||
# Release 0.2.3 (2020-01-09)
|
||||
|
||||
- [`Ratio` now performs earlier reductions to avoid overflow with `+-*/%` operators][42].
|
||||
- [`Ratio::{new_raw, numer, denom}` are now `const fn` for Rust 1.31 and later][48].
|
||||
- [Updated the `autocfg` build dependency to 1.0][63].
|
||||
|
||||
**Contributors**: @cuviper, @dingelish, @jimbo1qaz, @maxbla
|
||||
|
||||
[42]: https://github.com/rust-num/num-rational/pull/42
|
||||
[48]: https://github.com/rust-num/num-rational/pull/48
|
||||
[63]: https://github.com/rust-num/num-rational/pull/63
|
||||
|
||||
# Release 0.2.2 (2019-06-10)
|
||||
|
||||
- [`Ratio` now implements `Zero::set_zero` and `One::set_one`][47].
|
||||
|
||||
**Contributors**: @cuviper, @ignatenkobrain, @vks
|
||||
|
||||
[47]: https://github.com/rust-num/num-rational/pull/47
|
||||
|
||||
# Release 0.2.1 (2018-06-22)
|
||||
|
||||
- Maintenance release to fix `html_root_url`.
|
||||
|
||||
# Release 0.2.0 (2018-06-19)
|
||||
|
||||
### Enhancements
|
||||
|
||||
- [`Ratio` now implements `One::is_one` and the `Inv` trait][19].
|
||||
- [`Ratio` now implements `Sum` and `Product`][25].
|
||||
- [`Ratio` now supports `i128` and `u128` components][29] with Rust 1.26+.
|
||||
- [`Ratio` now implements the `Pow` trait][21].
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
- [`num-rational` now requires rustc 1.15 or greater][18].
|
||||
- [There is now a `std` feature][23], enabled by default, along with the
|
||||
implication that building *without* this feature makes this a `#![no_std]`
|
||||
crate. A few methods now require `FloatCore` instead of `Float`.
|
||||
- [The `serde` dependency has been updated to 1.0][24], and `rustc-serialize`
|
||||
is no longer supported by `num-rational`.
|
||||
- The optional `num-bigint` dependency has been updated to 0.2, and should be
|
||||
enabled using the `bigint-std` feature. In the future, it may be possible
|
||||
to use the `bigint` feature with `no_std`.
|
||||
|
||||
**Contributors**: @clarcharr, @cuviper, @Emerentius, @robomancer-or, @vks
|
||||
|
||||
[18]: https://github.com/rust-num/num-rational/pull/18
|
||||
[19]: https://github.com/rust-num/num-rational/pull/19
|
||||
[21]: https://github.com/rust-num/num-rational/pull/21
|
||||
[23]: https://github.com/rust-num/num-rational/pull/23
|
||||
[24]: https://github.com/rust-num/num-rational/pull/24
|
||||
[25]: https://github.com/rust-num/num-rational/pull/25
|
||||
[29]: https://github.com/rust-num/num-rational/pull/29
|
||||
|
||||
|
||||
# Release 0.1.42 (2018-02-08)
|
||||
|
||||
- Maintenance release to update dependencies.
|
||||
|
||||
|
||||
# Release 0.1.41 (2018-01-26)
|
||||
|
||||
- [num-rational now has its own source repository][num-356] at [rust-num/num-rational][home].
|
||||
- [`Ratio` now implements `CheckedAdd`, `CheckedSub`, `CheckedMul`, and `CheckedDiv`][11].
|
||||
- [`Ratio` now implements `AddAssign`, `SubAssign`, `MulAssign`, `DivAssign`, and `RemAssign`][12]
|
||||
with either `Ratio` or an integer on the right side. The non-assignment operators now also
|
||||
accept integers as an operand.
|
||||
- [`Ratio` operators now make fewer `clone()` calls][14].
|
||||
|
||||
Thanks to @c410-f3r, @cuviper, and @psimonyi for their contributions!
|
||||
|
||||
[home]: https://github.com/rust-num/num-rational
|
||||
[num-356]: https://github.com/rust-num/num/pull/356
|
||||
[11]: https://github.com/rust-num/num-rational/pull/11
|
||||
[12]: https://github.com/rust-num/num-rational/pull/12
|
||||
[14]: https://github.com/rust-num/num-rational/pull/14
|
||||
|
||||
|
||||
# Prior releases
|
||||
|
||||
No prior release notes were kept. Thanks all the same to the many
|
||||
contributors that have made this crate what it is!
|
8
vendor/num-rational/build.rs
vendored
Normal file
8
vendor/num-rational/build.rs
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
fn main() {
|
||||
let ac = autocfg::new();
|
||||
if ac.probe_expression("format!(\"{:e}\", 0_isize)") {
|
||||
println!("cargo:rustc-cfg=has_int_exp_fmt");
|
||||
}
|
||||
|
||||
autocfg::rerun_path("build.rs");
|
||||
}
|
3106
vendor/num-rational/src/lib.rs
vendored
Normal file
3106
vendor/num-rational/src/lib.rs
vendored
Normal file
File diff suppressed because it is too large
Load Diff
173
vendor/num-rational/src/pow.rs
vendored
Normal file
173
vendor/num-rational/src/pow.rs
vendored
Normal file
@ -0,0 +1,173 @@
|
||||
use crate::Ratio;
|
||||
|
||||
use core::cmp;
|
||||
use num_integer::Integer;
|
||||
use num_traits::{One, Pow};
|
||||
|
||||
macro_rules! pow_unsigned_impl {
|
||||
(@ $exp:ty) => {
|
||||
type Output = Ratio<T>;
|
||||
#[inline]
|
||||
fn pow(self, expon: $exp) -> Ratio<T> {
|
||||
Ratio::new_raw(self.numer.pow(expon), self.denom.pow(expon))
|
||||
}
|
||||
};
|
||||
($exp:ty) => {
|
||||
impl<T: Clone + Integer + Pow<$exp, Output = T>> Pow<$exp> for Ratio<T> {
|
||||
pow_unsigned_impl!(@ $exp);
|
||||
}
|
||||
impl<'a, T: Clone + Integer> Pow<$exp> for &'a Ratio<T>
|
||||
where
|
||||
&'a T: Pow<$exp, Output = T>,
|
||||
{
|
||||
pow_unsigned_impl!(@ $exp);
|
||||
}
|
||||
impl<'b, T: Clone + Integer + Pow<$exp, Output = T>> Pow<&'b $exp> for Ratio<T> {
|
||||
type Output = Ratio<T>;
|
||||
#[inline]
|
||||
fn pow(self, expon: &'b $exp) -> Ratio<T> {
|
||||
Pow::pow(self, *expon)
|
||||
}
|
||||
}
|
||||
impl<'a, 'b, T: Clone + Integer> Pow<&'b $exp> for &'a Ratio<T>
|
||||
where
|
||||
&'a T: Pow<$exp, Output = T>,
|
||||
{
|
||||
type Output = Ratio<T>;
|
||||
#[inline]
|
||||
fn pow(self, expon: &'b $exp) -> Ratio<T> {
|
||||
Pow::pow(self, *expon)
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
pow_unsigned_impl!(u8);
|
||||
pow_unsigned_impl!(u16);
|
||||
pow_unsigned_impl!(u32);
|
||||
pow_unsigned_impl!(u64);
|
||||
pow_unsigned_impl!(u128);
|
||||
pow_unsigned_impl!(usize);
|
||||
|
||||
macro_rules! pow_signed_impl {
|
||||
(@ &'b BigInt, BigUint) => {
|
||||
type Output = Ratio<T>;
|
||||
#[inline]
|
||||
fn pow(self, expon: &'b BigInt) -> Ratio<T> {
|
||||
match expon.sign() {
|
||||
Sign::NoSign => One::one(),
|
||||
Sign::Minus => {
|
||||
Pow::pow(self, expon.magnitude()).into_recip()
|
||||
}
|
||||
Sign::Plus => Pow::pow(self, expon.magnitude()),
|
||||
}
|
||||
}
|
||||
};
|
||||
(@ $exp:ty, $unsigned:ty) => {
|
||||
type Output = Ratio<T>;
|
||||
#[inline]
|
||||
fn pow(self, expon: $exp) -> Ratio<T> {
|
||||
match expon.cmp(&0) {
|
||||
cmp::Ordering::Equal => One::one(),
|
||||
cmp::Ordering::Less => {
|
||||
let expon = expon.wrapping_abs() as $unsigned;
|
||||
Pow::pow(self, expon).into_recip()
|
||||
}
|
||||
cmp::Ordering::Greater => Pow::pow(self, expon as $unsigned),
|
||||
}
|
||||
}
|
||||
};
|
||||
($exp:ty, $unsigned:ty) => {
|
||||
impl<T: Clone + Integer + Pow<$unsigned, Output = T>> Pow<$exp> for Ratio<T> {
|
||||
pow_signed_impl!(@ $exp, $unsigned);
|
||||
}
|
||||
impl<'a, T: Clone + Integer> Pow<$exp> for &'a Ratio<T>
|
||||
where
|
||||
&'a T: Pow<$unsigned, Output = T>,
|
||||
{
|
||||
pow_signed_impl!(@ $exp, $unsigned);
|
||||
}
|
||||
impl<'b, T: Clone + Integer + Pow<$unsigned, Output = T>> Pow<&'b $exp> for Ratio<T> {
|
||||
type Output = Ratio<T>;
|
||||
#[inline]
|
||||
fn pow(self, expon: &'b $exp) -> Ratio<T> {
|
||||
Pow::pow(self, *expon)
|
||||
}
|
||||
}
|
||||
impl<'a, 'b, T: Clone + Integer> Pow<&'b $exp> for &'a Ratio<T>
|
||||
where
|
||||
&'a T: Pow<$unsigned, Output = T>,
|
||||
{
|
||||
type Output = Ratio<T>;
|
||||
#[inline]
|
||||
fn pow(self, expon: &'b $exp) -> Ratio<T> {
|
||||
Pow::pow(self, *expon)
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
pow_signed_impl!(i8, u8);
|
||||
pow_signed_impl!(i16, u16);
|
||||
pow_signed_impl!(i32, u32);
|
||||
pow_signed_impl!(i64, u64);
|
||||
pow_signed_impl!(i128, u128);
|
||||
pow_signed_impl!(isize, usize);
|
||||
|
||||
#[cfg(feature = "num-bigint")]
|
||||
mod bigint {
|
||||
use super::*;
|
||||
use num_bigint::{BigInt, BigUint, Sign};
|
||||
|
||||
impl<T: Clone + Integer + for<'b> Pow<&'b BigUint, Output = T>> Pow<BigUint> for Ratio<T> {
|
||||
type Output = Ratio<T>;
|
||||
#[inline]
|
||||
fn pow(self, expon: BigUint) -> Ratio<T> {
|
||||
Pow::pow(self, &expon)
|
||||
}
|
||||
}
|
||||
impl<'a, T: Clone + Integer> Pow<BigUint> for &'a Ratio<T>
|
||||
where
|
||||
&'a T: for<'b> Pow<&'b BigUint, Output = T>,
|
||||
{
|
||||
type Output = Ratio<T>;
|
||||
#[inline]
|
||||
fn pow(self, expon: BigUint) -> Ratio<T> {
|
||||
Pow::pow(self, &expon)
|
||||
}
|
||||
}
|
||||
impl<'b, T: Clone + Integer + Pow<&'b BigUint, Output = T>> Pow<&'b BigUint> for Ratio<T> {
|
||||
pow_unsigned_impl!(@ &'b BigUint);
|
||||
}
|
||||
impl<'a, 'b, T: Clone + Integer> Pow<&'b BigUint> for &'a Ratio<T>
|
||||
where
|
||||
&'a T: Pow<&'b BigUint, Output = T>,
|
||||
{
|
||||
pow_unsigned_impl!(@ &'b BigUint);
|
||||
}
|
||||
|
||||
impl<T: Clone + Integer + for<'b> Pow<&'b BigUint, Output = T>> Pow<BigInt> for Ratio<T> {
|
||||
type Output = Ratio<T>;
|
||||
#[inline]
|
||||
fn pow(self, expon: BigInt) -> Ratio<T> {
|
||||
Pow::pow(self, &expon)
|
||||
}
|
||||
}
|
||||
impl<'a, T: Clone + Integer> Pow<BigInt> for &'a Ratio<T>
|
||||
where
|
||||
&'a T: for<'b> Pow<&'b BigUint, Output = T>,
|
||||
{
|
||||
type Output = Ratio<T>;
|
||||
#[inline]
|
||||
fn pow(self, expon: BigInt) -> Ratio<T> {
|
||||
Pow::pow(self, &expon)
|
||||
}
|
||||
}
|
||||
impl<'b, T: Clone + Integer + Pow<&'b BigUint, Output = T>> Pow<&'b BigInt> for Ratio<T> {
|
||||
pow_signed_impl!(@ &'b BigInt, BigUint);
|
||||
}
|
||||
impl<'a, 'b, T: Clone + Integer> Pow<&'b BigInt> for &'a Ratio<T>
|
||||
where
|
||||
&'a T: Pow<&'b BigUint, Output = T>,
|
||||
{
|
||||
pow_signed_impl!(@ &'b BigInt, BigUint);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user