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

Commit 43c670d

Browse files
bors[bot]Joonas Koivunenkoivunej
authored
Merge #392
392: Refresh docs r=koivunej a=koivunej Adds at least top level documentation for many types, hides some unnecessary re-exports, removes warnings from nightly rustdoc on bad links, and so on. Cc: #197 (this leaves us with 185 errors) Co-authored-by: Joonas Koivunen <joonas@equilibrium.co> Co-authored-by: Joonas Koivunen <joonas.koivunen@gmail.com>
2 parents 86bf01c + 4a5b564 commit 43c670d

File tree

19 files changed

+230
-97
lines changed

19 files changed

+230
-97
lines changed

bitswap/src/behaviour.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ use std::{
2626
},
2727
};
2828

29+
/// Event used to communicate with the swarm or the higher level behaviour.
2930
#[derive(Clone, Debug, Eq, PartialEq)]
3031
pub enum BitswapEvent {
3132
ReceivedBlock(PeerId, Block),
3233
ReceivedWant(PeerId, Cid, Priority),
3334
ReceivedCancel(PeerId, Cid),
3435
}
3536

37+
/// Bitswap statistics.
3638
#[derive(Debug, Default)]
3739
pub struct Stats {
3840
pub sent_blocks: AtomicU64,

bitswap/src/block.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
use cid::Cid;
22

3+
/// An Ipfs block consisting of a [`Cid`] and the bytes of the block.
4+
///
5+
/// Note: At the moment the equality is based on [`Cid`] equality, which is based on the triple
6+
/// `(cid::Version, cid::Codec, multihash)`.
37
#[derive(Clone, Debug)]
48
pub struct Block {
9+
/// The content identifier for this block
510
pub cid: Cid,
11+
/// The data of this block
612
pub data: Box<[u8]>,
713
}
814

@@ -11,6 +17,7 @@ impl PartialEq for Block {
1117
self.cid.hash() == other.cid.hash()
1218
}
1319
}
20+
1421
impl Eq for Block {}
1522

1623
impl Block {

http/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
# ipfs-http crate
22

3-
HTTP api on top of ipfs crate. The end binary has some rudimentary ipfs CLI
3+
HTTP api on top of `ipfs` crate. The end binary has some rudimentary ipfs CLI
44
functionality but mostly in the aim of testing the `rust-ipfs` via:
55

6-
* [ipfs-rust-conformance](https://github.com/rs-ipfs/ipfs-rust-conformance)
6+
* [conformance](../conformance)
77
* [interop](https://github.com/rs-ipfs/interop/)
88

9+
The vision for this crate is to eventually provide warp filters and async
10+
methods suitable to providing the Ipfs HTTP API in other applications as well
11+
instead of having to write application specific debug and introspection APIs.
12+
913
HTTP specs:
1014

11-
* https://docs.ipfs.io/reference/api/http/
15+
* https://docs.ipfs.io/reference/http/api/
1216

1317
Status: Pre-alpha, most of the functionality is missing or `501 Not
1418
Implemented`. See the repository level README for more information.

http/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! go-ipfs compatible configuration file handling or at least setup.
1+
//! go-ipfs compatible configuration file handling and setup.
22
33
use parity_multiaddr::Multiaddr;
44
use serde::{Deserialize, Serialize};

http/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//! `ipfs-http` http API implementation.
2+
//!
3+
//! This crate is most useful as a binary used first and foremost for compatibility testing against
4+
//! other ipfs implementations.
5+
16
#[macro_use]
27
extern crate tracing;
38

http/src/v0.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
//! Implementation of `/api/v0` HTTP endpoints.
2+
//!
3+
//! See https://docs.ipfs.io/reference/http/api/ for more information.
4+
15
use ipfs::{Ipfs, IpfsTypes};
26
use warp::{query, Filter};
37

src/dag.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! `ipfs.dag` interface implementation around [`Ipfs`].
2+
13
use crate::error::Error;
24
use crate::ipld::{decode_ipld, encode_ipld, Ipld};
35
use crate::path::{IpfsPath, SlashedPath};
@@ -854,7 +856,7 @@ mod tests {
854856
// FIXME: validate that go-ipfs still does this
855857
let equiv_paths = vec![
856858
prefix.sub_path("0/0").unwrap(),
857-
prefix.into_sub_path("0/./0").unwrap(),
859+
prefix.sub_path("0/./0").unwrap(),
858860
];
859861

860862
for p in equiv_paths {

src/error.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
//! Crate-wide errors.
2+
//!
3+
//! The error handling in `ipfs` is subject to change in the future.
4+
5+
/// Just re-export anyhow for now.
6+
///
7+
/// # Stability
8+
///
9+
/// Very likely to change in the future.
110
pub use anyhow::Error;
211

12+
/// A try conversion failed.
13+
///
14+
/// # Stability
15+
///
16+
/// Very likely to change in the future.
317
pub struct TryError;

src/ipld/ipld_macro.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/// Easy to use nested [`crate::ipld::Ipld`] creation with syntax similar to
2+
/// [`serde_json::json`](https://docs.rs/serde_json/1.0/serde_json/macro.json.html) macro.
13
#[macro_export(local_inner_macros)]
24
macro_rules! make_ipld {
35
// Hide distracting implementation details from the generated rustdoc.

src/ipld/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
// This code was adapted from https://github.com/ipfs-rust/rust-ipld, and most of
2-
// its code is the same as at revision b2286c53c13f3eeec2a3766387f2926838e8e4c9;
3-
// it used to be a direct dependency, but recent updates to cid and multihash crates
4-
// made it incompatible with them.
1+
//! IPLD dag-json, dag-cbor and some dag-pb functionality.
2+
//!
3+
//! This code was adapted from https://github.com/ipfs-rust/rust-ipld, and most of
4+
//! its code is the same as at revision b2286c53c13f3eeec2a3766387f2926838e8e4c9;
5+
//! it used to be a direct dependency, but recent updates to cid and multihash crates
6+
//! made it incompatible with them.
57
68
pub mod dag_cbor;
79
pub mod dag_json;

0 commit comments

Comments
 (0)