Created
May 8, 2017 12:21
-
-
Save killercup/2431b7861f671d20ee00e43d71d8d65c to your computer and use it in GitHub Desktop.
extern crate in doctest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root] | |
name = "playground" | |
version = "0.1.0" | |
dependencies = [ | |
"serde_json 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "dtoa" | |
version = "0.4.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "itoa" | |
version = "0.3.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "num-traits" | |
version = "0.1.37" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "serde" | |
version = "1.0.2" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "serde_json" | |
version = "1.0.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"dtoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
"itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
"num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", | |
"serde 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[metadata] | |
"checksum dtoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "80c8b71fd71146990a9742fc06dcbbde19161a267e0ad4e572c35162f4578c90" | |
"checksum itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eb2f404fbc66fd9aac13e998248505e7ecb2ad8e44ab6388684c5fb11c6c251c" | |
"checksum num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "e1cbfa3781f3fe73dc05321bed52a06d2d491eaa764c52335cf4399f046ece99" | |
"checksum serde 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3b46a59dd63931010fdb1d88538513f3279090d88b5c22ef4fe8440cfffcc6e3" | |
"checksum serde_json 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1c62115693d0a9ed8c32d1c760f0fdbe7d4b05cb13c135b9b54137ac0d59fccb" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
authors = ["Pascal Hertleif <killercup@gmail.com>"] | |
name = "playground" | |
version = "0.1.0" | |
[lib] | |
path = "lib.rs" | |
[dependencies] | |
serde_json = "1.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Return a random integer | |
/// | |
/// ```rust | |
/// # #[macro_use] extern crate serde_json as json; | |
/// # extern crate playground; | |
/// # use playground::*; | |
/// # fn main() { | |
/// let value = random_int(); | |
/// let response = json!({"val": value}); | |
/// assert!(response["val"].is_i64()); | |
/// # } | |
/// ``` | |
pub fn random_int() -> i32 { | |
4 | |
} | |
fn main() {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment