Skip to content

Commit 3cfc77c

Browse files
committed
fixup
1 parent 94b7032 commit 3cfc77c

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,18 @@ Here is a basic example of how to set up `iroh-blobs` with `iroh`:
3535
```rust,no_run
3636
use iroh::{protocol::Router, Endpoint};
3737
use iroh_blobs::{store::mem::MemStore, BlobsProtocol, ticket::BlobTicket};
38+
use n0_error::{Result, StdResultExt};
3839
3940
#[tokio::main]
40-
async fn main() -> n0_error::Result<()> {
41+
async fn main() -> Result<()> {
4142
// create an iroh endpoint that includes the standard discovery mechanisms
4243
// we've built at number0
4344
let endpoint = Endpoint::bind().await?;
4445
4546
// create a protocol handler using an in-memory blob store.
4647
let store = MemStore::new();
4748
let tag = store.add_slice(b"Hello world").await?;
48-
49+
4950
let _ = endpoint.online().await;
5051
let addr = endpoint.addr();
5152
let ticket = BlobTicket::new(addr, tag.hash, tag.format);
@@ -62,7 +63,7 @@ async fn main() -> n0_error::Result<()> {
6263
tokio::signal::ctrl_c().await;
6364
6465
// clean shutdown of router and store
65-
router.shutdown().await?;
66+
router.shutdown().await.anyerr()?;
6667
Ok(())
6768
}
6869
```
@@ -86,4 +87,4 @@ at your option.
8687

8788
Unless you explicitly state otherwise, any contribution intentionally submitted
8889
for inclusion in this project by you, as defined in the Apache-2.0 license,
89-
shall be dual licensed as above, without any additional terms or conditions.
90+
shall be dual licensed as above, without any additional terms or conditions.

examples/get-blob.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use clap::Parser;
55
use common::setup_logging;
66
use iroh::discovery::pkarr::PkarrResolver;
77
use iroh_blobs::{get::request::GetBlobItem, ticket::BlobTicket, BlobFormat};
8-
use n0_error::bail_any;
8+
use n0_error::{bail_any, ensure_any};
99
use n0_future::StreamExt;
1010
use tokio::io::AsyncWriteExt;
1111

@@ -34,7 +34,7 @@ async fn main() -> n0_error::Result<()> {
3434
.discovery(PkarrResolver::n0_dns())
3535
.bind()
3636
.await?;
37-
n0_error::ensure!(
37+
ensure_any!(
3838
ticket.format() == BlobFormat::Raw,
3939
"This example only supports raw blobs."
4040
);

examples/mdns-discovery.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use iroh::{
1818
discovery::mdns::MdnsDiscovery, protocol::Router, Endpoint, PublicKey, RelayMode, SecretKey,
1919
};
2020
use iroh_blobs::{store::mem::MemStore, BlobsProtocol, Hash};
21-
use n0_error::{ensure, Result, StdResultExt};
21+
use n0_error::{ensure_any, Result, StdResultExt};
2222

2323
mod common;
2424
use common::{get_or_generate_secret_key, setup_logging};
@@ -109,7 +109,7 @@ async fn connect(node_id: PublicKey, hash: Hash, out: Option<PathBuf>) -> Result
109109
);
110110
if let Some(path) = out {
111111
let absolute = std::env::current_dir()?.join(&path);
112-
ensure!(!absolute.is_dir(), "output must not be a directory");
112+
ensure_any!(!absolute.is_dir(), "output must not be a directory");
113113
println!(
114114
"exporting {hash} to {} -> {}",
115115
path.display(),

0 commit comments

Comments
 (0)