commit 844caac05c22957fa835a036a11b721f074558d2 Author: Brian Anderson Date: Mon Feb 20 11:22:19 2017 -0800 Initial diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7aef303 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +target +*~ diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..55e9647 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,64 @@ +[root] +name = "rust-cookbook" +version = "0.1.0" +dependencies = [ + "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "skeptic 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "byteorder" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "getopts" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libc" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "pulldown-cmark" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "skeptic" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "pulldown-cmark 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tempdir" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[metadata] +"checksum byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c40977b0ee6b9885c9013cd41d9feffdd22deb3bb4dc3a71d901cc7a77de18c8" +"checksum getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9047cfbd08a437050b363d35ef160452c5fe8ea5187ae0a624708c91581d685" +"checksum libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)" = "684f330624d8c3784fb9558ca46c4ce488073a8d22450415c5eb4f4cfb0d11b5" +"checksum pulldown-cmark 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8361e81576d2e02643b04950e487ec172b687180da65c731c03cf336784e6c07" +"checksum rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "022e0636ec2519ddae48154b028864bdce4eaf7d35226ab8e65c611be97b189d" +"checksum skeptic 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "34c7f11b6755efa4abfd2739426c17de0a36153510bacd6147113fd3a9f2634d" +"checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..60fcfe7 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "rust-cookbook" +version = "0.1.0" +authors = ["Brian Anderson "] + +build = "build.rs" + +[dependencies] +byteorder = "1.0.0" + +[build-dependencies] +skeptic = "0.6" + +[dev-dependencies] +skeptic = "0.6" diff --git a/README.md b/README.md new file mode 100644 index 0000000..8ca8580 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +```rust +extern crate byteorder; + +use std::io::Cursor; +use byteorder::{BigEndian, ReadBytesExt}; + +fn main() { + let mut rdr = Cursor::new(vec![2, 5, 3, 0]); + // Note that we use type parameters to indicate which kind of byte + // order we want! + assert_eq!(517, rdr.read_u16::().unwrap()); + assert_eq!(768, rdr.read_u16::().unwrap()); +} +``` diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..a780b3d --- /dev/null +++ b/build.rs @@ -0,0 +1,5 @@ +extern crate skeptic; + +fn main() { + skeptic::generate_doc_tests(&["README.md"]); +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/tests/skeptic.rs b/tests/skeptic.rs new file mode 100644 index 0000000..ff46c9c --- /dev/null +++ b/tests/skeptic.rs @@ -0,0 +1 @@ +include!(concat!(env!("OUT_DIR"), "/skeptic-tests.rs"));