From 77a5171b6541aceea6ddd3c4012522acdbd15f73 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Fri, 18 Sep 2020 19:29:22 +0300 Subject: feat: make ChunkId usable in a HashMap and serializble We will soon be using ChunkId as keys in a HashMap and serialize them in HTTP server responses. This commit enables those things. --- src/chunkid.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/chunkid.rs b/src/chunkid.rs index 771cc8c..ba301a1 100644 --- a/src/chunkid.rs +++ b/src/chunkid.rs @@ -1,4 +1,6 @@ +use serde::Serialize; use std::fmt; +use std::hash::Hash; use std::str::FromStr; use uuid::Uuid; @@ -17,7 +19,7 @@ use uuid::Uuid; /// /// Because every identifier is meant to be different, there is no /// default value, since default values should be identical. -#[derive(Debug, PartialEq, Clone)] +#[derive(Debug, Eq, PartialEq, Clone, Hash, Serialize)] pub struct ChunkId { id: String, } -- cgit v1.2.1