Skip to content
This repository was archived by the owner on Oct 23, 2022. It is now read-only.

Commit 86bf01c

Browse files
bors[bot]ljedrz
andauthored
Merge #391
391: Move the README example, remove the nightly feature and CI run r=koivunej a=ljedrz Moving the code example from the README to the `examples` simplifies our CI setup and makes one of the runs redundant. Co-authored-by: ljedrz <ljedrz@gmail.com>
2 parents 2b3bb72 + 6fb62f1 commit 86bf01c

File tree

5 files changed

+35
-60
lines changed

5 files changed

+35
-60
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -192,26 +192,6 @@ jobs:
192192
- name: cargo clippy
193193
run: cargo clippy --all-targets --workspace -- -D warnings
194194

195-
readme-doctest:
196-
runs-on: ubuntu-latest
197-
steps:
198-
- name: Checkout sources
199-
uses: actions/checkout@v2
200-
201-
- name: Cache cargo folder
202-
uses: actions/cache@v2
203-
with:
204-
path: ~/.cargo
205-
key: readme-doctest-${{ hashFiles('Cargo.lock') }}
206-
207-
- name: Install rust toolchain
208-
uses: hecrj/setup-rust-action@v1
209-
with:
210-
rust-version: nightly
211-
212-
- name: cargo test --features nightly
213-
run: cargo test --features nightly
214-
215195
# adapted from https://github.com/taiki-e/pin-project/blob/5878410863f5f25e21f7cba97b035501749850f9/.github/workflows/ci.yml#L136-L167
216196
ci-success:
217197
# this is read by bors
@@ -220,7 +200,6 @@ jobs:
220200
needs:
221201
- ci-matrix
222202
- lint-rust
223-
- readme-doctest
224203
runs-on: ubuntu-latest
225204
steps:
226205
- name: Mark the job as a success
@@ -233,7 +212,6 @@ jobs:
233212
needs:
234213
- ci-matrix
235214
- lint-rust
236-
- readme-doctest
237215
runs-on: ubuntu-latest
238216
steps:
239217
- name: Mark the job as failure

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ version = "0.1.0"
77

88
[features]
99
default = []
10-
nightly = []
1110
test_go_interop = []
1211
test_js_interop = []
1312

README.md

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -66,42 +66,10 @@ You will then find the binaries inside of the project root's `/target/debug` fol
6666
_Note: binaries available via `cargo install` is coming soon._
6767

6868
## Getting started
69-
```rust,no_run
70-
use tokio::task;
71-
use futures::join;
72-
use ipfs::{make_ipld, Ipfs, IpfsPath, Ipld, Types, UninitializedIpfs};
73-
74-
#[tokio::main]
75-
async fn main() {
76-
tracing_subscriber::fmt::init();
77-
78-
// Start daemon and initialize repo
79-
let (ipfs, fut): (Ipfs<Types>, _) = UninitializedIpfs::default().await.start().await.unwrap();
80-
task::spawn(fut);
81-
82-
// Create a DAG
83-
let f1 = ipfs.put_dag(make_ipld!("block1"));
84-
let f2 = ipfs.put_dag(make_ipld!("block2"));
85-
let (res1, res2) = join!(f1, f2);
86-
let root = make_ipld!([res1.unwrap(), res2.unwrap()]);
87-
let cid = ipfs.put_dag(root).await.unwrap();
88-
let path = IpfsPath::from(cid);
89-
90-
// Query the DAG
91-
let path1 = path.sub_path("0").unwrap();
92-
let path2 = path.sub_path("1").unwrap();
93-
let f1 = ipfs.get_dag(path1);
94-
let f2 = ipfs.get_dag(path2);
95-
let (res1, res2) = join!(f1, f2);
96-
println!("Received block with contents: {:?}", res1.unwrap());
97-
println!("Received block with contents: {:?}", res2.unwrap());
98-
99-
// Exit
100-
ipfs.exit_daemon();
101-
}
102-
```
10369

104-
More usage examples coming soon :+1:
70+
We recommend to browse the [examples](https://github.com/rs-ipfs/rust-ipfs/tree/master/examples) and
71+
[tests](https://github.com/rs-ipfs/rust-ipfs/tree/master/tests) in order to see how to use Rust-IPFS
72+
in different scenarios.
10573

10674
## Roadmap
10775

examples/dag_creation.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
use futures::join;
2+
use ipfs::{make_ipld, Ipfs, IpfsPath, Types, UninitializedIpfs};
3+
use tokio::task;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
tracing_subscriber::fmt::init();
8+
9+
// Initialize the repo and start a daemon
10+
let (ipfs, fut): (Ipfs<Types>, _) = UninitializedIpfs::default().await.start().await.unwrap();
11+
task::spawn(fut);
12+
13+
// Create a DAG
14+
let f1 = ipfs.put_dag(make_ipld!("block1"));
15+
let f2 = ipfs.put_dag(make_ipld!("block2"));
16+
let (res1, res2) = join!(f1, f2);
17+
let root = make_ipld!([res1.unwrap(), res2.unwrap()]);
18+
let cid = ipfs.put_dag(root).await.unwrap();
19+
let path = IpfsPath::from(cid);
20+
21+
// Query the DAG
22+
let path1 = path.sub_path("0").unwrap();
23+
let path2 = path.sub_path("1").unwrap();
24+
let f1 = ipfs.get_dag(path1);
25+
let f2 = ipfs.get_dag(path2);
26+
let (res1, res2) = join!(f1, f2);
27+
println!("Received block with contents: {:?}", res1.unwrap());
28+
println!("Received block with contents: {:?}", res2.unwrap());
29+
30+
// Exit
31+
ipfs.exit_daemon().await;
32+
}

src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! IPFS node implementation
22
//#![deny(missing_docs)]
3-
#![cfg_attr(feature = "nightly", feature(external_doc))]
4-
#![cfg_attr(feature = "nightly", doc(include = "../README.md"))]
53

64
mod config;
75
pub mod dag;

0 commit comments

Comments
 (0)