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