chore: cargo fmt again
This commit is contained in:
parent
5fed9c5220
commit
b1f635aa6e
@ -1,11 +1,10 @@
|
||||
///! dag-pb support operations. Placing this module inside unixfs module is a bit unfortunate but
|
||||
///! follows from the inseparability of dag-pb and UnixFS.
|
||||
|
||||
use std::convert::TryFrom;
|
||||
use std::borrow::Cow;
|
||||
use cid::Cid;
|
||||
use crate::pb::PBNode;
|
||||
use crate::InvalidCidInLink;
|
||||
use cid::Cid;
|
||||
use std::borrow::Cow;
|
||||
///! dag-pb support operations. Placing this module inside unixfs module is a bit unfortunate but
|
||||
///! follows from the inseparability of dag-pb and UnixFS.
|
||||
use std::convert::TryFrom;
|
||||
|
||||
/// Extracts the PBNode::Data field from the block as it appears on the block.
|
||||
pub fn node_data(block: &[u8]) -> Result<Option<&[u8]>, quick_protobuf::Error> {
|
||||
@ -18,10 +17,14 @@ pub fn node_data(block: &[u8]) -> Result<Option<&[u8]>, quick_protobuf::Error> {
|
||||
}
|
||||
|
||||
/// Extracts the PBNode::Links as Cids usable for the ipfs `refs` operation.
|
||||
pub fn nameless_links(block: &[u8]) -> Result<Result<Vec<Cid>, InvalidCidInLink>, quick_protobuf::Error> {
|
||||
pub fn nameless_links(
|
||||
block: &[u8],
|
||||
) -> Result<Result<Vec<Cid>, InvalidCidInLink>, quick_protobuf::Error> {
|
||||
let doc = PBNode::try_from(block)?;
|
||||
|
||||
Ok(doc.Links.into_iter()
|
||||
Ok(doc
|
||||
.Links
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.map(|(nth, link)| {
|
||||
let hash = link.Hash.as_deref().unwrap_or_default();
|
||||
@ -33,5 +36,3 @@ pub fn nameless_links(block: &[u8]) -> Result<Result<Vec<Cid>, InvalidCidInLink>
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>())
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user