From 2841ea7007b0f1c26ccdda158e8735fb6519d0c0 Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Thu, 13 Feb 2020 06:08:21 +0000 Subject: [PATCH] Setup virtual Cargo workspace --- Cargo.toml | 9 +++++++++ examples/Cargo.toml | 21 +++++++++++++++++++++ examples/one_level_http/Cargo.toml | 17 ----------------- examples/one_level_http/src/main.rs | 30 ------------------------------ examples/two-deep-http.rs | 30 ++++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+), 47 deletions(-) create mode 100644 Cargo.toml create mode 100644 examples/Cargo.toml delete mode 100644 examples/one_level_http/Cargo.toml delete mode 100644 examples/one_level_http/src/main.rs create mode 100644 examples/two-deep-http.rs diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..c50d400 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,9 @@ +[workspace] + +members = [ + "stork", + "stork_http", + + # Internal + "examples", +] \ No newline at end of file diff --git a/examples/Cargo.toml b/examples/Cargo.toml new file mode 100644 index 0000000..8578106 --- /dev/null +++ b/examples/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "examples" +version = "0.0.0" +publish = false +edition = "2018" + +[dev-dependencies] +tokio = { version = "0.2", features = ["full"] } +futures = "0.3" + +failure = "" + +digest = "" +meowhash = "" +generic-array = "" + +stork_http = { path = "../stork_http" } + +[[example]] +name = "two-deep-http" +path = "two-deep-http.rs" \ No newline at end of file diff --git a/examples/one_level_http/Cargo.toml b/examples/one_level_http/Cargo.toml deleted file mode 100644 index 7319294..0000000 --- a/examples/one_level_http/Cargo.toml +++ /dev/null @@ -1,17 +0,0 @@ -[package] -name = "stork-cli" -version = "0.1.0" -authors = ["Jordan Doyle "] -edition = "2018" - -[dependencies] -tokio = { version = "0.2", features = ["full"] } -futures = "0.3" - -failure = "" - -digest = "" -meowhash = "" -generic-array = "" - -stork_http = { path = "../../stork_http" } \ No newline at end of file diff --git a/examples/one_level_http/src/main.rs b/examples/one_level_http/src/main.rs deleted file mode 100644 index 11e7502..0000000 --- a/examples/one_level_http/src/main.rs +++ /dev/null @@ -1,30 +0,0 @@ -use futures::pin_mut; -use futures::stream::StreamExt; - -#[tokio::main] -async fn main() -> failure::Fallible<()> { - let args: Vec = std::env::args().collect(); - let url = args - .get(1) - .expect("Expecting URL parameter") - .parse() - .unwrap(); - - let stream = stork_http::HttpStorkable::new(url).exec(); - pin_mut!(stream); // needed for iteration - - while let Some(link) = stream.next().await { - let link = link?; - - println!("{:?}", link.val()); - - let stream = link.exec(); - pin_mut!(stream); // needed for iteration - - while let Some(link) = stream.next().await { - println!("> {:?}", link?.val()); - } - } - - Ok(()) -} diff --git a/examples/two-deep-http.rs b/examples/two-deep-http.rs new file mode 100644 index 0000000..11e7502 --- /dev/null +++ b/examples/two-deep-http.rs @@ -0,0 +1,30 @@ +use futures::pin_mut; +use futures::stream::StreamExt; + +#[tokio::main] +async fn main() -> failure::Fallible<()> { + let args: Vec = std::env::args().collect(); + let url = args + .get(1) + .expect("Expecting URL parameter") + .parse() + .unwrap(); + + let stream = stork_http::HttpStorkable::new(url).exec(); + pin_mut!(stream); // needed for iteration + + while let Some(link) = stream.next().await { + let link = link?; + + println!("{:?}", link.val()); + + let stream = link.exec(); + pin_mut!(stream); // needed for iteration + + while let Some(link) = stream.next().await { + println!("> {:?}", link?.val()); + } + } + + Ok(()) +} -- libgit2 1.7.2