Skip to content

Commit c3443e2

Browse files
committed
Add serde infrastructure
1 parent 06fb7d9 commit c3443e2

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ matrix:
2828
script:
2929
- cargo test
3030
- cargo test --tests --no-default-features
31+
- cargo test --features serde-1
3132
- cargo test --manifest-path rand-derive/Cargo.toml
3233

3334
env:

Cargo.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,26 @@ alloc = [] # enables Vec and Box support without std
2222

2323
i128_support = [] # enables i128 and u128 support
2424

25+
serde-1 = ["serde", "serde_derive"]
26+
27+
2528
[target.'cfg(unix)'.dependencies]
2629
libc = { version = "0.2", optional = true }
2730

2831
[target.'cfg(windows)'.dependencies]
2932
winapi = { version = "0.3", features = ["minwindef", "ntsecapi", "profileapi", "winnt"], optional = true }
3033

34+
[dependencies]
35+
serde = {version="1",optional=true}
36+
serde_derive = {version="1", optional=true}
37+
38+
[dev-dependencies]
39+
log = "0.3.0"
40+
# This is for testing serde, unfortunately
41+
# we can't specify feature-gated dev deps yet,
42+
# see: https://github.com/rust-lang/cargo/issues/1596
43+
bincode = "0.9"
44+
3145
[workspace]
3246
members = ["rand-derive"]
3347

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ build: false
3434
test_script:
3535
- cargo test --benches
3636
- cargo test
37+
- cargo test --features serde-1
3738
- cargo test --features nightly
3839
- cargo test --tests --no-default-features --features=alloc
3940
- cargo test --manifest-path rand-derive/Cargo.toml

src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,10 @@
249249

250250
#[cfg(feature="std")] extern crate std as core;
251251
#[cfg(all(feature = "alloc", not(feature="std")))] extern crate alloc;
252+
#[cfg(test)] #[macro_use] extern crate log;
253+
#[cfg(test)] #[cfg(feature="serde-1")] extern crate bincode;
254+
#[cfg(feature="serde-1")] extern crate serde;
255+
#[cfg(feature="serde-1")] #[macro_use] extern crate serde_derive;
252256

253257
use core::marker;
254258
use core::mem;

0 commit comments

Comments
 (0)