Skip to main content

object_rainbow/impls/
refs.rs

1use crate::*;
2
3impl<T: ?Sized + ToOutput> ToOutput for &T {
4    fn to_output(&self, output: &mut (impl ?Sized + Output)) {
5        (**self).to_output(output);
6    }
7
8    fn vec(&self) -> Vec<u8> {
9        (**self).vec()
10    }
11}
12
13impl<T: ?Sized + InlineOutput> InlineOutput for &T {}
14
15impl<T: ?Sized + ListHashes> ListHashes for &T {
16    fn list_hashes(&self, f: &mut (impl ?Sized + FnMut(Hash))) {
17        (**self).list_hashes(f);
18    }
19
20    fn topology_hash(&self) -> Hash {
21        (**self).topology_hash()
22    }
23
24    fn point_count(&self) -> usize {
25        (**self).point_count()
26    }
27}
28
29impl<T: ?Sized + Tagged> Tagged for &T {
30    const TAGS: Tags = T::TAGS;
31    const HASH: Hash = T::HASH;
32}
33
34impl<T: ?Sized + Topological> Topological for &T {
35    fn traverse(&self, visitor: &mut (impl ?Sized + PointVisitor)) {
36        (**self).traverse(visitor);
37    }
38
39    fn topology(&self) -> TopoVec {
40        (**self).topology()
41    }
42
43    fn to_resolve(&self) -> Arc<dyn Resolve> {
44        (**self).to_resolve()
45    }
46}
47
48impl<T: ?Sized + ByteOrd> ByteOrd for &T {
49    fn bytes_cmp(&self, other: &Self) -> std::cmp::Ordering {
50        (**self).bytes_cmp(other)
51    }
52}
53
54impl<T: ?Sized + Size> Size for &T {
55    type Size = T::Size;
56    const SIZE: usize = T::SIZE;
57}
58
59impl<T: ?Sized + MaybeHasNiche> MaybeHasNiche for &T {
60    type MnArray = T::MnArray;
61}
62
63impl<T: ?Sized + Output> Output for &mut T {
64    fn write(&mut self, data: &[u8]) {
65        (**self).write(data);
66    }
67
68    fn is_real(&self) -> bool {
69        (**self).is_real()
70    }
71
72    fn is_mangling(&self) -> bool {
73        (**self).is_mangling()
74    }
75}
76
77impl<T: ?Sized + PointVisitor> PointVisitor for &mut T {
78    fn visit(&mut self, point: &(impl 'static + SingularFetch<T: Traversible> + Clone)) {
79        (**self).visit(point);
80    }
81}