diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-09-18 19:29:22 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2020-09-18 19:49:01 +0300 |
commit | 77a5171b6541aceea6ddd3c4012522acdbd15f73 (patch) | |
tree | 55ae9004c4fce1cfd4ce922fb1001e5a72624366 /src/chunkid.rs | |
parent | 1b8ee07b4a241ad4bf69e4c5210166f4a4216e30 (diff) | |
download | obnam2-77a5171b6541aceea6ddd3c4012522acdbd15f73.tar.gz |
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.
Diffstat (limited to 'src/chunkid.rs')
-rw-r--r-- | src/chunkid.rs | 4 |
1 files changed, 3 insertions, 1 deletions
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, } |