hashlib_prelude/hashable/mod.rs
1// Copyright (C) 2018 Boyu Yang
2//
3// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6// option. This file may not be copied, modified, or distributed
7// except according to those terms.
8
9use crate::{HashAlgo, HashAlgoKernel};
10
11pub trait Hashable<Algo>
12where
13 Algo: HashAlgo,
14{
15 fn hash(
16 &self,
17 ) -> Result<
18 <<Algo as HashAlgo>::Kernel as HashAlgoKernel>::Output,
19 <<Algo as HashAlgo>::Kernel as HashAlgoKernel>::Error,
20 >;
21}
22
23#[cfg(feature = "impl-as-ref")]
24mod as_ref;
25
26#[cfg(not(feature = "impl-as-ref"))]
27mod for_each;