Merge pull request #221 from cuviper/num-no_std

Use no_std-compatible num dependencies
This commit is contained in:
Brandon W Maister 2018-03-04 18:21:50 -05:00 committed by GitHub
commit 2a825edd5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 10 deletions

View File

@ -21,7 +21,8 @@ name = "chrono"
[dependencies]
time = "^0.1.36"
num = { version = "0.1", default-features = false }
num-integer = { version = "0.1.36", default-features = false }
num-traits = { version = "0.2", default-features = false }
rustc-serialize = { version = "0.3", optional = true }
serde = { version = "1", optional = true }
@ -29,6 +30,7 @@ serde = { version = "1", optional = true }
serde_json = { version = "1" }
serde_derive = { version = "1" }
bincode = { version = "0.8.0" }
num-iter = { version = "0.1.35", default-features = false }
[package.metadata.docs.rs]
all-features = true

View File

@ -7,7 +7,7 @@
// Algorithm from [Daan Leijen. _Division and Modulus for Computer Scientists_,
// December 2001](http://research.microsoft.com/pubs/151917/divmodnote-letter.pdf)
pub use num::integer::{div_rem, div_floor, mod_floor, div_mod_floor};
pub use num_integer::{div_rem, div_floor, mod_floor, div_mod_floor};
#[cfg(test)]
mod tests {

View File

@ -4,7 +4,7 @@
//! A collection of parsed date and time items.
//! They can be constructed incrementally while being checked for consistency.
use num::traits::ToPrimitive;
use num_traits::ToPrimitive;
use oldtime::Duration as OldDuration;
use {Datelike, Timelike};

View File

@ -397,7 +397,8 @@
#![cfg_attr(feature = "cargo-clippy", allow(const_static_lifetime, redundant_field_names))]
extern crate time as oldtime;
extern crate num;
extern crate num_integer;
extern crate num_traits;
#[cfg(feature = "rustc-serialize")]
extern crate rustc_serialize;
#[cfg(feature = "serde")]
@ -618,7 +619,7 @@ impl Weekday {
/// Any weekday can be represented as an integer from 0 to 6, which equals to
/// [`Weekday::num_days_from_monday`](#method.num_days_from_monday) in this implementation.
/// Do not heavily depend on this though; use explicit methods whenever possible.
impl num::traits::FromPrimitive for Weekday {
impl num_traits::FromPrimitive for Weekday {
#[inline]
fn from_i64(n: i64) -> Option<Weekday> {
match n {
@ -933,9 +934,11 @@ pub trait Timelike: Sized {
}
}
#[cfg(test)] extern crate num_iter;
#[test]
fn test_readme_doomsday() {
use num::iter::range_inclusive;
use num_iter::range_inclusive;
for y in range_inclusive(naive::MIN_DATE.year(), naive::MAX_DATE.year()) {
// even months

View File

@ -5,7 +5,7 @@
use std::{str, fmt};
use std::ops::{Add, Sub, AddAssign, SubAssign};
use num::traits::ToPrimitive;
use num_traits::ToPrimitive;
use oldtime::Duration as OldDuration;
use {Weekday, Datelike};

View File

@ -5,7 +5,7 @@
use std::{str, fmt, hash};
use std::ops::{Add, Sub, AddAssign, SubAssign};
use num::traits::ToPrimitive;
use num_traits::ToPrimitive;
use oldtime::Duration as OldDuration;
use {Weekday, Timelike, Datelike};

View File

@ -16,7 +16,7 @@
#![allow(dead_code)] // some internal methods have been left for consistency
use std::{i32, fmt};
use num::traits::FromPrimitive;
use num_traits::FromPrimitive;
use Weekday;
use div::{div_rem, mod_floor};
@ -469,12 +469,13 @@ impl fmt::Debug for Mdf {
#[cfg(test)]
mod tests {
#[cfg(test)] extern crate num_iter;
#[cfg(bench)] extern crate test;
use Weekday;
use super::{Of, Mdf};
use super::{YearFlags, A, B, C, D, E, F, G, AG, BA, CB, DC, ED, FE, GF};
use num::iter::range_inclusive;
use num_iter::range_inclusive;
use std::u32;
const NONLEAP_FLAGS: [YearFlags; 7] = [A, B, C, D, E, F, G];