From 29f0591613daa86b265bab5531727a1c33690643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Klaehn?= Date: Wed, 11 Dec 2024 14:26:06 +0200 Subject: [PATCH] remove setup example again (#37) --- Cargo.toml | 4 ---- examples/setup.rs | 35 ----------------------------------- 2 files changed, 39 deletions(-) delete mode 100644 examples/setup.rs diff --git a/Cargo.toml b/Cargo.toml index 68717d35..56660f90 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -151,10 +151,6 @@ required-features = ["example-iroh"] name = "custom-protocol" required-features = ["example-iroh"] -[[example]] -name = "setup" -required-features = ["example-iroh"] - [lints.rust] missing_debug_implementations = "warn" diff --git a/examples/setup.rs b/examples/setup.rs deleted file mode 100644 index c8b93330..00000000 --- a/examples/setup.rs +++ /dev/null @@ -1,35 +0,0 @@ -use iroh::{protocol::Router, Endpoint}; -use iroh_blobs::{net_protocol::Blobs, util::local_pool::LocalPool}; - -#[tokio::main] -async fn main() -> anyhow::Result<()> { - // create an iroh endpoint that includes the standard discovery mechanisms - // we've built at number0 - let endpoint = Endpoint::builder().discovery_n0().bind().await?; - - // spawn a local pool with one thread per CPU - // for a single threaded pool use `LocalPool::single` - let local_pool = LocalPool::default(); - - // create an in-memory blob store - // use `iroh_blobs::net_protocol::Blobs::persistent` to load or create a - // persistent blob store from a path - let blobs = Blobs::memory().build(local_pool.handle(), &endpoint); - - // turn on the "rpc" feature if you need to create blobs and tags clients - let blobs_client = blobs.client(); - let tags_client = blobs_client.tags(); - - // build the router - let router = Router::builder(endpoint) - .accept(iroh_blobs::ALPN, blobs.clone()) - .spawn() - .await?; - - // do fun stuff with the blobs protocol! - // make sure not to drop the local_pool before you are finished - router.shutdown().await?; - drop(local_pool); - drop(tags_client); - Ok(()) -}