Skip to main content

blake2b256_balloon/
lib.rs

1// Copyright (C) 2019 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
9pub mod kernel;
10
11use balloons::{Balloon, BalloonBuilder};
12
13/// The builder of `Blake2b256Balloon`.
14#[derive(Default)]
15pub struct Blake2b256BalloonBuilder(BalloonBuilder);
16
17/// The builder of `Blake2b256Balloon`.
18pub type Blake2b256Balloon = Balloon<kernel::U256, kernel::H256, kernel::Blake2b256>;
19
20impl ::std::ops::Deref for Blake2b256BalloonBuilder {
21    type Target = BalloonBuilder;
22    fn deref(&self) -> &Self::Target {
23        &self.0
24    }
25}
26
27impl ::std::ops::DerefMut for Blake2b256BalloonBuilder {
28    fn deref_mut(&mut self) -> &mut Self::Target {
29        &mut self.0
30    }
31}
32
33impl AsMut<BalloonBuilder> for Blake2b256BalloonBuilder {
34    fn as_mut(&mut self) -> &mut BalloonBuilder {
35        &mut self.0
36    }
37}
38
39impl Blake2b256BalloonBuilder {
40    pub fn new() -> Self {
41        Default::default()
42    }
43
44    pub fn build(&self) -> Blake2b256Balloon {
45        self.0.build()
46    }
47}