object_rainbow/impls/
arc.rs

1use crate::*;
2
3impl<T: ToOutput> ToOutput for Arc<T> {
4    fn to_output(&self, output: &mut dyn Output) {
5        (**self).to_output(output);
6    }
7}
8
9impl<T: Parse<I>, I: ParseInput> Parse<I> for Arc<T> {
10    fn parse(input: I) -> crate::Result<Self> {
11        T::parse(input).map(Self::new)
12    }
13}
14
15impl<T: ParseInline<I>, I: ParseInput> ParseInline<I> for Arc<T> {
16    fn parse_inline(input: &mut I) -> crate::Result<Self> {
17        T::parse_inline(input).map(Self::new)
18    }
19}
20
21impl<T: Topological> Topological for Arc<T> {
22    fn accept_points(&self, visitor: &mut impl PointVisitor) {
23        (**self).accept_points(visitor);
24    }
25
26    fn topology_hash(&self) -> Hash {
27        (**self).topology_hash()
28    }
29
30    fn topology(&self) -> TopoVec {
31        (**self).topology()
32    }
33}
34
35impl<T: Tagged> Tagged for Arc<T> {
36    const TAGS: Tags = T::TAGS;
37
38    const HASH: Hash = T::HASH;
39}
40
41impl<T: Object> Object for Arc<T> {
42    fn full_hash(&self) -> Hash {
43        (**self).full_hash()
44    }
45}
46
47impl<T: Inline> Inline for Arc<T> {}
48
49impl<T: ReflessObject> ReflessObject for Arc<T> {}
50
51impl<T: ReflessInline> ReflessInline for Arc<T> {}
52
53impl<T: Size> Size for Arc<T> {
54    const SIZE: usize = T::SIZE;
55    type Size = T::Size;
56}
57
58impl<T: MaybeHasNiche> MaybeHasNiche for Arc<T> {
59    type MnArray = T::MnArray;
60}
61
62impl<T: Clone> Equivalent<T> for Arc<T> {
63    fn into_equivalent(self) -> T {
64        Arc::unwrap_or_clone(self)
65    }
66
67    fn from_equivalent(object: T) -> Self {
68        Arc::new(object)
69    }
70}