Skip to content

Release 0.2.0 #367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jun 30, 2018
16 changes: 9 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
language: rust
rust:
- 1.15.0
- 1.22.0
- 1.26.0
- stable
- beta
- nightly
matrix:
include:
- rust: 1.8.0
before_script:
# rand 0.3.22 started depending on rand 0.4, which requires rustc 1.15
# manually hacking the lockfile due to the limitations of cargo#2773
- cargo generate-lockfile
- sed -i -e 's/"rand 0.[34].[0-9]\+/"rand 0.3.20/' Cargo.lock
- sed -i -e '/^name = "rand"/,/^$/s/version = "0.3.[0-9]\+"/version = "0.3.20"/' Cargo.lock
# try a target that doesn't have std at all
- rust: stable
env: TARGET=thumbv6m-none-eabi
script:
- rustup target add $TARGET
- cargo build --verbose --target $TARGET --no-default-features
sudo: false
script:
- cargo build --verbose
Expand Down
64 changes: 43 additions & 21 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,76 @@ description = "A collection of numeric types and traits for Rust, including bigi
documentation = "https://docs.rs/num"
homepage = "https://github.com/rust-num/num"
keywords = ["mathematics", "numerics", "bignum"]
categories = [ "algorithms", "data-structures", "science" ]
categories = [ "algorithms", "data-structures", "science", "no-std" ]
license = "MIT/Apache-2.0"
repository = "https://github.com/rust-num/num"
name = "num"
version = "0.1.42"
version = "0.2.0"
readme = "README.md"

[package.metadata.docs.rs]
features = ["std", "serde", "rand"]

[badges]
travis-ci = { repository = "rust-num/num" }

[dependencies]

[dependencies.num-bigint]
optional = true
version = "0.1.42"
optional = true # needs std
version = "0.2.0"
default-features = false

[dependencies.num-complex]
optional = true
version = "0.1.42"
version = "0.2.0"
default-features = false

[dependencies.num-integer]
version = "0.1.36"
version = "0.1.39"
default-features = false

[dependencies.num-iter]
version = "0.1.35"
version = "0.1.37"
default-features = false

[dependencies.num-rational]
optional = true
version = "0.1.42"
version = "0.2.1"
default-features = false

[dependencies.num-traits]
version = "0.2.0"
version = "0.2.5"
default-features = false

[dev-dependencies]

[features]
bigint = ["num-bigint"]
complex = ["num-complex"]
rational = ["num-rational"]
default = ["bigint", "complex", "rational", "rustc-serialize"]
default = ["std"]

std = [
"num-bigint/std",
"num-complex/std",
"num-integer/std",
"num-iter/std",
"num-rational/std", "num-rational/bigint",
"num-traits/std",
]

i128 = [
"num-bigint/i128",
"num-complex/i128",
"num-integer/i128",
"num-iter/i128",
"num-rational/i128",
"num-traits/i128",
]

rand = [
"num-bigint/rand",
"num-complex/rand",
]

serde = [
"num-bigint/serde",
"num-complex/serde",
"num-rational/serde"
]
rustc-serialize = [
"num-bigint/rustc-serialize",
"num-complex/rustc-serialize",
"num-rational/rustc-serialize"
"num-rational/serde",
]
113 changes: 88 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![crate](https://img.shields.io/crates/v/num.svg)](https://crates.io/crates/num)
[![documentation](https://docs.rs/num/badge.svg)](https://docs.rs/num)
![minimum rustc 1.8](https://img.shields.io/badge/rustc-1.8+-red.svg)
![minimum rustc 1.15](https://img.shields.io/badge/rustc-1.15+-red.svg)
[![Travis status](https://travis-ci.org/rust-num/num.svg?branch=master)](https://travis-ci.org/rust-num/num)

A collection of numeric types and traits for Rust.
Expand All @@ -13,36 +13,26 @@ and generic range iterators.

`num` is a meta-crate, re-exporting items from these sub-crates:

- [`num-bigint`](https://github.com/rust-num/num-bigint)
[![crate](https://img.shields.io/crates/v/num-bigint.svg)](https://crates.io/crates/num-bigint)
| Repository | Crate | Documentation |
| ---------- | ----- | ------------- |
| [`num-bigint`] | [![crate][bigint-cb]][bigint-c] | [![documentation][bigint-db]][bigint-d]
| [`num-complex`] | [![crate][complex-cb]][complex-c] | [![documentation][complex-db]][complex-d]
| [`num-integer`] | [![crate][integer-cb]][integer-c] | [![documentation][integer-db]][integer-d]
| [`num-iter`] | [![crate][iter-cb]][iter-c] | [![documentation][iter-db]][iter-d]
| [`num-rational`] | [![crate][rational-cb]][rational-c] | [![documentation][rational-db]][rational-d]
| [`num-traits`] | [![crate][traits-cb]][traits-c] | [![documentation][traits-db]][traits-d]
| ([`num-derive`]) | [![crate][derive-cb]][derive-c] | [![documentation][derive-db]][derive-d]

- [`num-complex`](https://github.com/rust-num/num-complex)
[![crate](https://img.shields.io/crates/v/num-complex.svg)](https://crates.io/crates/num-complex)

- [`num-integer`](https://github.com/rust-num/num-integer)
[![crate](https://img.shields.io/crates/v/num-integer.svg)](https://crates.io/crates/num-integer)

- [`num-iter`](https://github.com/rust-num/num-iter)
[![crate](https://img.shields.io/crates/v/num-iter.svg)](https://crates.io/crates/num-iter)

- [`num-rational`](https://github.com/rust-num/num-rational)
[![crate](https://img.shields.io/crates/v/num-rational.svg)](https://crates.io/crates/num-rational)

- [`num-traits`](https://github.com/rust-num/num-traits)
[![crate](https://img.shields.io/crates/v/num-traits.svg)](https://crates.io/crates/num-traits)

There is also a `proc-macro` crate for deriving some numeric traits:

- [`num-derive`](https://github.com/rust-num/num-derive)
[![crate](https://img.shields.io/crates/v/num-derive.svg)](https://crates.io/crates/num-derive)
Note: `num-derive` is listed here for reference, but it's not directly included
in `num`. This is a `proc-macro` crate for deriving some of `num`'s traits.

## Usage

Add this to your `Cargo.toml`:

```toml
[dependencies]
num = "0.1"
num = "0.2"
```

and this to your crate root:
Expand All @@ -51,11 +41,84 @@ and this to your crate root:
extern crate num;
```

## 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]
version = "0.2"
default-features = false
```

The `num-bigint` crate is only available when `std` is enabled, and the other
sub-crates may have limited functionality when used without `std`.

Implementations for `i128` and `u128` are only available with Rust 1.26 and
later. The build script automatically detects this, but you can make it
mandatory by enabling the `i128` crate feature.

The `rand` feature enables randomization traits in `num-bigint` and
`num-complex`.

The `serde` feature enables serialization for types in `num-bigint`,
`num-complex`, and `num-rational`.

The `num` meta-crate no longer supports features to toggle the inclusion of
the individual sub-crates. If you need such control, you are recommended to
directly depend on your required crates instead.

## Releases

Release notes are available in [RELEASES.md](RELEASES.md).

## Compatibility

Most of the `num` crates are tested for rustc 1.8 and greater.
The exception is `num-derive` which requires at least rustc 1.15.
The `num` crate as a whole is tested for rustc 1.15 and greater.

The `num-traits`, `num-integer`, and `num-iter` crates are individually tested
for rustc 1.8 and greater, if you require such older compatibility.


[`num-bigint`]: https://github.com/rust-num/num-bigint
[bigint-c]: https://crates.io/crates/num-bigint
[bigint-cb]: https://img.shields.io/crates/v/num-bigint.svg
[bigint-d]: https://docs.rs/num-bigint/
[bigint-db]: https://docs.rs/num-bigint/badge.svg

[`num-complex`]: https://github.com/rust-num/num-complex
[complex-c]: https://crates.io/crates/num-complex
[complex-cb]: https://img.shields.io/crates/v/num-complex.svg
[complex-d]: https://docs.rs/num-complex/
[complex-db]: https://docs.rs/num-complex/badge.svg

[`num-derive`]: https://github.com/rust-num/num-derive
[derive-c]: https://crates.io/crates/num-derive
[derive-cb]: https://img.shields.io/crates/v/num-derive.svg
[derive-d]: https://docs.rs/num-derive/
[derive-db]: https://docs.rs/num-derive/badge.svg

[`num-integer`]: https://github.com/rust-num/num-integer
[integer-c]: https://crates.io/crates/num-integer
[integer-cb]: https://img.shields.io/crates/v/num-integer.svg
[integer-d]: https://docs.rs/num-integer/
[integer-db]: https://docs.rs/num-integer/badge.svg

[`num-iter`]: https://github.com/rust-num/num-iter
[iter-c]: https://crates.io/crates/num-iter
[iter-cb]: https://img.shields.io/crates/v/num-iter.svg
[iter-d]: https://docs.rs/num-iter/
[iter-db]: https://docs.rs/num-iter/badge.svg

[`num-rational`]: https://github.com/rust-num/num-rational
[rational-c]: https://crates.io/crates/num-rational
[rational-cb]: https://img.shields.io/crates/v/num-rational.svg
[rational-d]: https://docs.rs/num-rational/
[rational-db]: https://docs.rs/num-rational/badge.svg

[`num-traits`]: https://github.com/rust-num/num-traits
[traits-c]: https://crates.io/crates/num-traits
[traits-cb]: https://img.shields.io/crates/v/num-traits.svg
[traits-d]: https://docs.rs/num-traits/
[traits-db]: https://docs.rs/num-traits/badge.svg
44 changes: 43 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,46 @@
# Release 0.1.42
# Release 0.2.0 (2018-06-29)

All items exported from `num-integer`, `num-iter`, and `num-traits` are still
semver-compatible with those exported by `num` 0.1. If you have these as public
dependencies in your own crates, it is not a breaking change to move to `num`
0.2. However, this is not true of `num-bigint`, `num-complex`, or
`num-rational`, as those exported items are distinct in this release.

A few common changes are listed below, but most of the development happens in
the individual sub-crates. Please consult their release notes for more details
about recent changes:
[`num-bigint`](https://github.com/rust-num/num-bigint/blob/master/RELEASES.md),
[`num-complex`](https://github.com/rust-num/num-complex/blob/master/RELEASES.md),
[`num-integer`](https://github.com/rust-num/num-integer/blob/master/RELEASES.md),
[`num-iter`](https://github.com/rust-num/num-iter/blob/master/RELEASES.md),
[`num-rational`](https://github.com/rust-num/num-rational/blob/master/RELEASES.md),
and [`num-traits`](https://github.com/rust-num/num-traits/blob/master/RELEASES.md).

### Enhancements

- Updates to `num-integer`, `num-iter`, and `num-traits` are still compatible
with `num` 0.1.
- 128-bit integers are supported with Rust 1.26 and later.
- `BigInt`, `BigUint`, `Complex`, and `Ratio` all implement `Sum` and `Product`.

### Breaking Changes

- `num` now requires rustc 1.15 or greater.
- `num-bigint`, `num-complex`, and `num-rational` have all been updated to 0.2.
- It's no longer possible to toggle individual `num-*` sub-crates using cargo
features. If you need that control, please use those crates directly.
- There is now a `std` feature, enabled by default, along with the implication
that building *without* this feature makes this a `#![no_std]` crate.
`num::bigint` is not available without `std`, and the other sub-crates may
have limited functionality.
- The `serde` dependency has been updated to 1.0, still disabled by default.
The `rustc-serialize` crate is no longer supported by `num`.
- The `rand` dependency has been updated to 0.5, now disabled by default. This
requires rustc 1.22 or greater for `rand`'s own requirement.

**Contributors**: @CAD97, @cuviper, and the many sub-crate contributors!

# Release 0.1.42 (2018-02-08)

- [All of the num sub-crates now have their own source repositories][num-356].
- Updated num sub-crates to their latest versions.
Expand Down
11 changes: 2 additions & 9 deletions ci/rustup.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
#!/bin/sh
# Use rustup to locally run the same suite of tests as .travis.yml.
# (You should first install/update 1.8.0, stable, beta, and nightly.)
# (You should first install/update all versions listed below.)

set -ex

export TRAVIS_RUST_VERSION
for TRAVIS_RUST_VERSION in 1.8.0 stable beta nightly; do
for TRAVIS_RUST_VERSION in 1.15.0 1.22.0 1.26.0 stable beta nightly; do
run="rustup run $TRAVIS_RUST_VERSION"
if [ "$TRAVIS_RUST_VERSION" = 1.8.0 ]; then
# rand 0.3.22 started depending on rand 0.4, which requires rustc 1.15
# manually hacking the lockfile due to the limitations of cargo#2773
$run cargo generate-lockfile
$run sed -i -e 's/"rand 0.[34].[0-9]\+/"rand 0.3.20/' Cargo.lock
$run sed -i -e '/^name = "rand"/,/^$/s/version = "0.3.[0-9]\+"/version = "0.3.20"/' Cargo.lock
fi
$run cargo build --verbose
$run $PWD/ci/test_full.sh
done
21 changes: 15 additions & 6 deletions ci/test_full.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ set -ex

echo Testing num on rustc ${TRAVIS_RUST_VERSION}

FEATURES="serde"
if [[ "$TRAVIS_RUST_VERSION" =~ ^(nightly|beta|stable|1.26.0|1.22.0)$ ]]; then
FEATURES="$FEATURES rand"
fi
if [[ "$TRAVIS_RUST_VERSION" =~ ^(nightly|beta|stable|1.26.0)$ ]]; then
FEATURES="$FEATURES i128"
fi

# num should build and test everywhere.
cargo build --verbose
cargo test --verbose
Expand All @@ -13,11 +21,12 @@ cargo build --no-default-features
cargo test --no-default-features

# Each isolated feature should also work everywhere.
for feature in bigint complex rational rustc-serialize serde; do
cargo build --verbose --no-default-features --features="$feature"
cargo test --verbose --no-default-features --features="$feature"
# (but still with "std", else bigint breaks)
for feature in $FEATURES; do
cargo build --verbose --no-default-features --features="std $feature"
cargo test --verbose --no-default-features --features="std $feature"
done

# Downgrade serde and build test the 0.7.0 channel as well
cargo update -p serde --precise 0.7.0
cargo build --verbose --features "serde"
# test all supported features together
cargo build --features="std $FEATURES"
cargo test --features="std $FEATURES"
Loading