Enum rust_ipfs::dag::ResolvedNode
source · pub enum ResolvedNode {
Block(Block),
DagPbData(Cid, NodeData<Box<[u8]>>),
Projection(Cid, Ipld),
Link(Cid, Cid),
}
Expand description
IpfsPath
’s Cid
-based variant can be resolved to the block, projections represented by this
type.
Values can be converted to Ipld using Ipld::try_from
.
Variants§
Block(Block)
Block which was loaded at the end of the path.
DagPbData(Cid, NodeData<Box<[u8]>>)
Path ended in Data
at a dag-pb node. This is usually not interesting and should be
treated as a “Not found” error since dag-pb node did not have a link called Data
. The variant
exists as there are interface-ipfs-http tests which require this behaviour.
Projection(Cid, Ipld)
Path ended on a !dag-pb document which was projected.
Link(Cid, Cid)
Local resolving ended with a link
Implementations§
source§impl ResolvedNode
impl ResolvedNode
sourcepub fn source(&self) -> &Cid
pub fn source(&self) -> &Cid
Returns the Cid
of the source document for the encapsulated document or projection of such.
sourcepub fn into_unixfs_block(self) -> Result<Block, UnexpectedResolved>
pub fn into_unixfs_block(self) -> Result<Block, UnexpectedResolved>
Unwraps the dagpb block variant and turns others into UnexpectedResolved. This is useful wherever unixfs operations are continued after resolving an IpfsPath.
Trait Implementations§
source§impl Debug for ResolvedNode
impl Debug for ResolvedNode
source§impl PartialEq for ResolvedNode
impl PartialEq for ResolvedNode
source§fn eq(&self, other: &ResolvedNode) -> bool
fn eq(&self, other: &ResolvedNode) -> bool
self
and other
values to be equal, and is used
by ==
.