From 0e8216bf38dc857974939b500321aa1c3800c18c Mon Sep 17 00:00:00 2001 From: Fredrik Date: Mon, 9 Oct 2017 14:56:59 +0200 Subject: [PATCH] Add some comments --- libp2p-peer/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libp2p-peer/src/lib.rs b/libp2p-peer/src/lib.rs index 994c479d..a798abe6 100644 --- a/libp2p-peer/src/lib.rs +++ b/libp2p-peer/src/lib.rs @@ -2,7 +2,12 @@ extern crate base58; use base58::ToBase58; +/// A PeerId is a reference to a multihash +/// Ideally we would want to store the Multihash object directly here but because +/// the multihash package is lacking some things right now, lets store a reference to +/// some bytes that represent the full bytes of the multihash pub struct PeerId<'a> { + /// Rereference to multihash bytes multihash: &'a [u8] } @@ -12,6 +17,8 @@ impl<'a> PeerId<'a> { PeerId { multihash: mh } } + /// Outputs the multihash as a Base58 string, + /// this is what we use as our stringified version of the ID pub fn to_base58(&self) -> String { self.multihash.to_base58() }