parsec/gossip/event_hash.rs
1// Copyright 2018 MaidSafe.net limited.
2//
3// This SAFE Network Software is licensed to you under The General Public License (GPL), version 3.
4// Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed
5// under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
6// KIND, either express or implied. Please review the Licences for the specific language governing
7// permissions and limitations relating to use of the SAFE Network Software.
8
9use crate::hash::Hash;
10use std::fmt::{self, Debug, Formatter};
11
12/// Hash of the event contents.
13#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
14pub struct EventHash(pub(super) Hash);
15
16impl Debug for EventHash {
17 fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
18 self.0.fmt(formatter)
19 }
20}
21
22impl EventHash {
23 #[cfg(any(all(test, feature = "mock"), feature = "testing"))]
24 pub(crate) const ZERO: Self = EventHash(Hash::ZERO);
25}