🏡 index : ~doyle/stork.git

author Jordan Doyle <jordan@doyle.la> 2020-02-13 5:18:58.0 +00:00:00
committer Jordan Doyle <jordan@doyle.la> 2020-02-13 5:28:49.0 +00:00:00
commit
9f41acd218c3487d73076b13825cea2848978f9c [patch]
tree
0a2e39563d994a9575c324e7bf12fff4235f777c
parent
764be4719b7fac766f6a436bde018bd525e6519c
download
9f41acd218c3487d73076b13825cea2848978f9c.tar.gz

Move example to its own directory



Diff

 .gitignore                          |  1 +
 Cargo.toml                          | 17 -----------------
 src/main.rs                         | 30 ------------------------------
 examples/one_level_http/Cargo.toml  | 17 +++++++++++++++++
 examples/one_level_http/src/main.rs | 30 ++++++++++++++++++++++++++++++
 5 files changed, 48 insertions(+), 47 deletions(-)

diff --git a/.gitignore b/.gitignore
index 1bc34f6..798f5c8 100644
--- a/.gitignore
+++ a/.gitignore
@@ -1,5 +1,6 @@
/target
/stork*/target
examples/**/target
**/*.rs.bk
.idea/
Cargo.lock
diff --git a/Cargo.toml b/Cargo.toml
deleted file mode 100644
index 83b0950..0000000 100644
--- a/Cargo.toml
+++ /dev/null
@@ -1,17 +1,0 @@
[package]
name = "stork-cli"
version = "0.1.0"
authors = ["Jordan Doyle <jordan@doyle.la>"]
edition = "2018"

[dependencies]
tokio = { version = "0.2", features = ["full"] }
futures = "0.3"

failure = ""

digest = ""
meowhash = ""
generic-array = ""

stork_http = { path = "stork_http" }
diff --git a/src/main.rs b/src/main.rs
deleted file mode 100644
index 11e7502..0000000 100644
--- a/src/main.rs
+++ /dev/null
@@ -1,30 +1,0 @@
use futures::pin_mut;
use futures::stream::StreamExt;

#[tokio::main]
async fn main() -> failure::Fallible<()> {
    let args: Vec<String> = 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/one_level_http/Cargo.toml b/examples/one_level_http/Cargo.toml
new file mode 100644
index 0000000..7319294 100644
--- /dev/null
+++ a/examples/one_level_http/Cargo.toml
@@ -1,0 +1,17 @@
[package]
name = "stork-cli"
version = "0.1.0"
authors = ["Jordan Doyle <jordan@doyle.la>"]
edition = "2018"

[dependencies]
tokio = { version = "0.2", features = ["full"] }
futures = "0.3"

failure = ""

digest = ""
meowhash = ""
generic-array = ""

stork_http = { path = "../../stork_http" }
diff --git a/examples/one_level_http/src/main.rs b/examples/one_level_http/src/main.rs
new file mode 100644
index 0000000..11e7502 100644
--- /dev/null
+++ a/examples/one_level_http/src/main.rs
@@ -1,0 +1,30 @@
use futures::pin_mut;
use futures::stream::StreamExt;

#[tokio::main]
async fn main() -> failure::Fallible<()> {
    let args: Vec<String> = 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(())
}