Skip to content

Commit

Permalink
Require serde1 to enable serde support (reverts recent change)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhardy committed Jun 12, 2019
1 parent 1991d0c commit 69912ea
Show file tree
Hide file tree
Showing 18 changed files with 33 additions and 33 deletions.
6 changes: 3 additions & 3 deletions rand_pcg/src/pcg128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const MULTIPLIER: u128 = 0x2360_ED05_1FC6_5DA4_4385_DF64_9FCC_F645;
use core::fmt;
use core::mem::transmute;
use rand_core::{RngCore, SeedableRng, Error, le};
#[cfg(feature="serde")] use serde::{Serialize, Deserialize};
#[cfg(feature="serde1")] use serde::{Serialize, Deserialize};

/// A PCG random number generator (XSL RR 128/64 (LCG) variant).
///
Expand All @@ -31,7 +31,7 @@ use rand_core::{RngCore, SeedableRng, Error, le};
/// comprising 128 bits of state and 128 bits stream selector. These are both
/// set by `SeedableRng`, using a 256-bit seed.
#[derive(Clone)]
#[cfg_attr(feature="serde", derive(Serialize,Deserialize))]
#[cfg_attr(feature="serde1", derive(Serialize,Deserialize))]
pub struct Lcg128Xsl64 {
state: u128,
increment: u128,
Expand Down Expand Up @@ -130,7 +130,7 @@ impl RngCore for Lcg128Xsl64 {
/// output function), this RNG is faster, also has a long cycle, and still has
/// good performance on statistical tests.
#[derive(Clone)]
#[cfg_attr(feature="serde", derive(Serialize,Deserialize))]
#[cfg_attr(feature="serde1", derive(Serialize,Deserialize))]
pub struct Mcg128Xsl64 {
state: u128,
}
Expand Down
4 changes: 2 additions & 2 deletions rand_pcg/src/pcg64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

use core::fmt;
use rand_core::{RngCore, SeedableRng, Error, le, impls};
#[cfg(feature="serde")] use serde::{Serialize, Deserialize};
#[cfg(feature="serde1")] use serde::{Serialize, Deserialize};

// This is the default multiplier used by PCG for 64-bit state.
const MULTIPLIER: u64 = 6364136223846793005;
Expand All @@ -30,7 +30,7 @@ const MULTIPLIER: u64 = 6364136223846793005;
/// comprising 64 bits of state and 64 bits stream selector. These are both set
/// by `SeedableRng`, using a 128-bit seed.
#[derive(Clone)]
#[cfg_attr(feature="serde", derive(Serialize,Deserialize))]
#[cfg_attr(feature="serde1", derive(Serialize,Deserialize))]
pub struct Lcg64Xsh32 {
state: u64,
increment: u64,
Expand Down
2 changes: 1 addition & 1 deletion rand_pcg/tests/lcg128xsl64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn test_lcg128xsl64_true_values() {
assert_eq!(results, expected);
}

#[cfg(feature="serde")]
#[cfg(feature="serde1")]
#[test]
fn test_lcg128xsl64_serde() {
use bincode;
Expand Down
2 changes: 1 addition & 1 deletion rand_pcg/tests/lcg64xsh32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fn test_lcg64xsh32_true_values() {
assert_eq!(results, expected);
}

#[cfg(feature="serde")]
#[cfg(feature="serde1")]
#[test]
fn test_lcg64xsh32_serde() {
use bincode;
Expand Down
2 changes: 1 addition & 1 deletion rand_pcg/tests/mcg128xsl64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fn test_mcg128xsl64_true_values() {
assert_eq!(results, expected);
}

#[cfg(feature="serde")]
#[cfg(feature="serde1")]
#[test]
fn test_mcg128xsl64_serde() {
use bincode;
Expand Down
4 changes: 2 additions & 2 deletions rand_xorshift/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use core::num::Wrapping as w;
use core::{fmt, slice};
use rand_core::{RngCore, SeedableRng, Error, impls, le};
#[cfg(feature="serde")] use serde::{Serialize, Deserialize};
#[cfg(feature="serde1")] use serde::{Serialize, Deserialize};

/// An Xorshift random number generator.
///
Expand All @@ -32,7 +32,7 @@ use rand_core::{RngCore, SeedableRng, Error, impls, le};
/// ["Xorshift RNGs"](https://www.jstatsoft.org/v08/i14/paper).
/// *Journal of Statistical Software*. Vol. 8 (Issue 14).
#[derive(Clone)]
#[cfg_attr(feature="serde", derive(Serialize,Deserialize))]
#[cfg_attr(feature="serde1", derive(Serialize,Deserialize))]
pub struct XorShiftRng {
x: w<u32>,
y: w<u32>,
Expand Down
2 changes: 1 addition & 1 deletion rand_xorshift/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fn test_xorshift_clone() {
}
}

#[cfg(feature="serde")]
#[cfg(feature="serde1")]
#[test]
fn test_xorshift_serde() {
use bincode;
Expand Down
4 changes: 2 additions & 2 deletions rand_xoshiro/src/splitmix64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[cfg(feature="serde")] use serde::{Serialize, Deserialize};
#[cfg(feature="serde1")] use serde::{Serialize, Deserialize};
use byteorder::{ByteOrder, LittleEndian};
use rand_core::le::read_u64_into;
use rand_core::impls::fill_bytes_via_next;
Expand All @@ -23,7 +23,7 @@ use rand_core::{RngCore, SeedableRng, Error};
/// from [`dsiutils`](http://dsiutils.di.unimi.it/) is used.
#[allow(missing_copy_implementations)]
#[derive(Debug, Clone)]
#[cfg_attr(feature="serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))]
pub struct SplitMix64 {
x: u64,
}
Expand Down
4 changes: 2 additions & 2 deletions rand_xoshiro/src/xoroshiro128plus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[cfg(feature="serde")] use serde::{Serialize, Deserialize};
#[cfg(feature="serde1")] use serde::{Serialize, Deserialize};
use rand_core;
use rand_core::le::read_u64_into;
use rand_core::impls::fill_bytes_via_next;
Expand All @@ -23,7 +23,7 @@ use rand_core::{RngCore, SeedableRng};
/// David Blackman and Sebastiano Vigna.
#[allow(missing_copy_implementations)]
#[derive(Debug, Clone)]
#[cfg_attr(feature="serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))]
pub struct Xoroshiro128Plus {
s0: u64,
s1: u64,
Expand Down
4 changes: 2 additions & 2 deletions rand_xoshiro/src/xoroshiro128starstar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[cfg(feature="serde")] use serde::{Serialize, Deserialize};
#[cfg(feature="serde1")] use serde::{Serialize, Deserialize};
use rand_core;
use rand_core::le::read_u64_into;
use rand_core::impls::fill_bytes_via_next;
Expand All @@ -22,7 +22,7 @@ use rand_core::{RngCore, SeedableRng};
/// David Blackman and Sebastiano Vigna.
#[allow(missing_copy_implementations)]
#[derive(Debug, Clone)]
#[cfg_attr(feature="serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))]
pub struct Xoroshiro128StarStar {
s0: u64,
s1: u64,
Expand Down
4 changes: 2 additions & 2 deletions rand_xoshiro/src/xoroshiro64star.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[cfg(feature="serde")] use serde::{Serialize, Deserialize};
#[cfg(feature="serde1")] use serde::{Serialize, Deserialize};
use rand_core;
use rand_core::le::read_u32_into;
use rand_core::impls::{fill_bytes_via_next, next_u64_via_u32};
Expand All @@ -23,7 +23,7 @@ use rand_core::{RngCore, SeedableRng};
/// David Blackman and Sebastiano Vigna.
#[allow(missing_copy_implementations)]
#[derive(Debug, Clone)]
#[cfg_attr(feature="serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))]
pub struct Xoroshiro64Star {
s0: u32,
s1: u32,
Expand Down
4 changes: 2 additions & 2 deletions rand_xoshiro/src/xoroshiro64starstar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[cfg(feature="serde")] use serde::{Serialize, Deserialize};
#[cfg(feature="serde1")] use serde::{Serialize, Deserialize};
use rand_core;
use rand_core::le::read_u32_into;
use rand_core::impls::{fill_bytes_via_next, next_u64_via_u32};
Expand All @@ -22,7 +22,7 @@ use rand_core::{RngCore, SeedableRng};
/// David Blackman and Sebastiano Vigna.
#[allow(missing_copy_implementations)]
#[derive(Debug, Clone)]
#[cfg_attr(feature="serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))]
pub struct Xoroshiro64StarStar {
s0: u32,
s1: u32,
Expand Down
4 changes: 2 additions & 2 deletions rand_xoshiro/src/xoshiro128plus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[cfg(feature="serde")] use serde::{Serialize, Deserialize};
#[cfg(feature="serde1")] use serde::{Serialize, Deserialize};
use rand_core::impls::{next_u64_via_u32, fill_bytes_via_next};
use rand_core::le::read_u32_into;
use rand_core::{SeedableRng, RngCore, Error};
Expand All @@ -21,7 +21,7 @@ use rand_core::{SeedableRng, RngCore, Error};
/// reference source code](http://xoshiro.di.unimi.it/xoshiro128starstar.c) by
/// David Blackman and Sebastiano Vigna.
#[derive(Debug, Clone)]
#[cfg_attr(feature="serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))]
pub struct Xoshiro128Plus {
s: [u32; 4],
}
Expand Down
4 changes: 2 additions & 2 deletions rand_xoshiro/src/xoshiro128starstar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[cfg(feature="serde")] use serde::{Serialize, Deserialize};
#[cfg(feature="serde1")] use serde::{Serialize, Deserialize};
use rand_core::impls::{next_u64_via_u32, fill_bytes_via_next};
use rand_core::le::read_u32_into;
use rand_core::{SeedableRng, RngCore, Error};
Expand All @@ -20,7 +20,7 @@ use rand_core::{SeedableRng, RngCore, Error};
/// reference source code](http://xoshiro.di.unimi.it/xoshiro128starstar.c) by
/// David Blackman and Sebastiano Vigna.
#[derive(Debug, Clone)]
#[cfg_attr(feature="serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))]
pub struct Xoshiro128StarStar {
s: [u32; 4],
}
Expand Down
4 changes: 2 additions & 2 deletions rand_xoshiro/src/xoshiro256plus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[cfg(feature="serde")] use serde::{Serialize, Deserialize};
#[cfg(feature="serde1")] use serde::{Serialize, Deserialize};
use rand_core::impls::fill_bytes_via_next;
use rand_core::le::read_u64_into;
use rand_core::{SeedableRng, RngCore, Error};
Expand All @@ -21,7 +21,7 @@ use rand_core::{SeedableRng, RngCore, Error};
/// reference source code](http://xoshiro.di.unimi.it/xoshiro256plus.c) by
/// David Blackman and Sebastiano Vigna.
#[derive(Debug, Clone)]
#[cfg_attr(feature="serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))]
pub struct Xoshiro256Plus {
s: [u64; 4],
}
Expand Down
4 changes: 2 additions & 2 deletions rand_xoshiro/src/xoshiro256starstar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[cfg(feature="serde")] use serde::{Serialize, Deserialize};
#[cfg(feature="serde1")] use serde::{Serialize, Deserialize};
use rand_core::impls::fill_bytes_via_next;
use rand_core::le::read_u64_into;
use rand_core::{SeedableRng, RngCore, Error};
Expand All @@ -20,7 +20,7 @@ use rand_core::{SeedableRng, RngCore, Error};
/// reference source code](http://xoshiro.di.unimi.it/xoshiro256starstar.c) by
/// David Blackman and Sebastiano Vigna.
#[derive(Debug, Clone)]
#[cfg_attr(feature="serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))]
pub struct Xoshiro256StarStar {
s: [u64; 4],
}
Expand Down
4 changes: 2 additions & 2 deletions rand_xoshiro/src/xoshiro512plus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[cfg(feature="serde")] use serde::{Serialize, Deserialize};
#[cfg(feature="serde1")] use serde::{Serialize, Deserialize};
use rand_core::impls::fill_bytes_via_next;
use rand_core::le::read_u64_into;
use rand_core::{SeedableRng, RngCore, Error};
Expand All @@ -23,7 +23,7 @@ use crate::Seed512;
/// reference source code](http://xoshiro.di.unimi.it/xoshiro512plus.c) by
/// David Blackman and Sebastiano Vigna.
#[derive(Debug, Clone)]
#[cfg_attr(feature="serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))]
pub struct Xoshiro512Plus {
s: [u64; 8],
}
Expand Down
4 changes: 2 additions & 2 deletions rand_xoshiro/src/xoshiro512starstar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[cfg(feature="serde")] use serde::{Serialize, Deserialize};
#[cfg(feature="serde1")] use serde::{Serialize, Deserialize};
use rand_core::impls::fill_bytes_via_next;
use rand_core::le::read_u64_into;
use rand_core::{SeedableRng, RngCore, Error};
Expand All @@ -22,7 +22,7 @@ use crate::Seed512;
/// reference source code](http://xoshiro.di.unimi.it/xoshiro512starstar.c) by
/// David Blackman and Sebastiano Vigna.
#[derive(Debug, Clone)]
#[cfg_attr(feature="serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature="serde1", derive(Serialize, Deserialize))]
pub struct Xoshiro512StarStar {
s: [u64; 8],
}
Expand Down

0 comments on commit 69912ea

Please sign in to comment.