summaryrefslogtreecommitdiffstats
path: root/src/types
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-06-15 19:24:27 +0200
committerMatthias Beyer <mail@beyermatthias.de>2019-06-15 19:24:27 +0200
commit93c440de45fe35951bdead563ec4477c88d156da (patch)
tree50da17a13ee08dadf7c44cd103862115f6fd7494 /src/types
parentd31967d74840877b1233350a09ffc427e16d9cfa (diff)
AsRef impls for the types
Diffstat (limited to 'src/types')
-rw-r--r--src/types/block.rs5
-rw-r--r--src/types/content.rs6
-rw-r--r--src/types/util.rs6
3 files changed, 17 insertions, 0 deletions
diff --git a/src/types/block.rs b/src/types/block.rs
index b044150..7b86783 100644
--- a/src/types/block.rs
+++ b/src/types/block.rs
@@ -37,3 +37,8 @@ impl Block {
}
}
+impl AsRef<Block> for Block {
+ fn as_ref(&self) -> &Self {
+ &self
+ }
+}
diff --git a/src/types/content.rs b/src/types/content.rs
index 8315804..63bad91 100644
--- a/src/types/content.rs
+++ b/src/types/content.rs
@@ -60,6 +60,12 @@ impl Content {
}
+impl AsRef<Content> for Content {
+ fn as_ref(&self) -> &Self {
+ &self
+ }
+}
+
/// The Payload type represents the Payload of a Content object
///
/// The Payload type contains several variants, as an update (new block) may be either just a
diff --git a/src/types/util.rs b/src/types/util.rs
index 074581c..c314757 100644
--- a/src/types/util.rs
+++ b/src/types/util.rs
@@ -36,6 +36,12 @@ impl ::std::fmt::Display for Timestamp {
#[derive(Serialize, Deserialize, Debug, Hash, PartialOrd, PartialEq, Ord, Eq, Clone)]
pub struct IPFSHash(String);
+impl AsRef<IPFSHash> for IPFSHash {
+ fn as_ref(&self) -> &Self {
+ &self
+ }
+}
+
impl From<String> for IPFSHash {
fn from(s: String) -> Self {
IPFSHash(s)