object_rainbow/
hashed.rs

1use std::ops::Deref;
2
3use crate::*;
4
5#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash, Tagged)]
6pub struct Hashed<T>(pub T);
7
8impl<T> Deref for Hashed<T> {
9    type Target = T;
10
11    fn deref(&self) -> &Self::Target {
12        &self.0
13    }
14}
15
16impl<T: ToOutput> ToOutput for Hashed<T> {
17    fn to_output(&self, output: &mut dyn object_rainbow::Output) {
18        self.0.data_hash().to_output(output);
19    }
20}
21
22impl<T: ToOutput> Size for Hashed<T> {
23    const SIZE: usize = Point::<T>::SIZE;
24    type Size = <Point<T> as Size>::Size;
25}