add changesetid/manifestid/entryid structure

Summary: add wrapper for nodehash

Reviewed By: lukaspiatkowski

Differential Revision: D6694937

fbshipit-source-id: c1c79fd8fb37d40211b84341105af1d6fa155708
This commit is contained in:
Xiaotian Wu 2018-01-16 07:44:37 -08:00 committed by Facebook Github Bot
parent 70244ff1d6
commit 7a3ef80526

View File

@ -135,3 +135,45 @@ impl Arbitrary for NodeHash {
single_shrinker(NULL_HASH)
}
}
#[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
#[derive(HeapSizeOf)]
pub struct ChangesetId(NodeHash);
impl ChangesetId {
pub fn new(hash: NodeHash) -> Self {
ChangesetId(hash)
}
pub fn into_nodehash(self) -> NodeHash {
self.0
}
}
#[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
#[derive(HeapSizeOf)]
pub struct ManifestId(NodeHash);
impl ManifestId {
pub fn new(hash: NodeHash) -> Self {
ManifestId(hash)
}
pub fn into_nodehash(self) -> NodeHash {
self.0
}
}
#[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)]
#[derive(HeapSizeOf)]
pub struct EntryId(NodeHash);
impl EntryId {
pub fn new(hash: NodeHash) -> Self {
EntryId(hash)
}
pub fn into_nodehash(self) -> NodeHash {
self.0
}
}