doc: add missing docs for IpldDag methods

This commit is contained in:
Niklas Long 2020-10-14 14:02:47 +02:00
parent d3c84ee52e
commit defa810788
2 changed files with 5 additions and 1 deletions

View File

@ -165,10 +165,14 @@ pub struct IpldDag<Types: RepoTypes> {
}
impl<Types: RepoTypes> IpldDag<Types> {
/// Creates a new `IpldDag` for DAG operations.
pub fn new(ipfs: Ipfs<Types>) -> Self {
IpldDag { ipfs }
}
/// Returns the `Cid` of a newly inserted block.
///
/// The block is created from the `data`, encoded with the `codec` and inserted into the repo.
pub async fn put(&self, data: Ipld, codec: Codec) -> Result<Cid, Error> {
let bytes = encode_ipld(&data, codec)?;
let hash = multihash::Sha2_256::digest(&bytes);

View File

@ -16,7 +16,7 @@
//! [go-ipfs]: https://github.com/ipfs/go-ipfs/
//! [js-ipfs]: https://github.com/ipfs/js-ipfs/
// We are not done yet, but uncommenting this makes it easier to hunt down for missing docs.
//#![deny(missing_docs)]
#![deny(missing_docs)]
//
// This isn't recognized in stable yet, but we should disregard any nags on these to keep making
// the docs better.