object_rainbow/impls/
arc.rs

1use crate::*;
2
3impl<T: ?Sized + 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: ?Sized + 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: ?Sized + Tagged> Tagged for Arc<T> {
36    const TAGS: Tags = T::TAGS;
37    const HASH: Hash = T::HASH;
38}
39
40impl<T: Object> Object for Arc<T> {
41    fn full_hash(&self) -> Hash {
42        (**self).full_hash()
43    }
44}
45
46impl<T: Inline> Inline for Arc<T> {}
47
48impl<T: ReflessObject> ReflessObject for Arc<T> {}
49
50impl<T: ReflessInline> ReflessInline for Arc<T> {}
51
52impl<T: ?Sized + Size> Size for Arc<T> {
53    const SIZE: usize = T::SIZE;
54    type Size = T::Size;
55}
56
57impl<T: ?Sized + MaybeHasNiche> MaybeHasNiche for Arc<T> {
58    type MnArray = T::MnArray;
59}
60
61impl<T: Clone> Equivalent<T> for Arc<T> {
62    fn into_equivalent(self) -> T {
63        Arc::unwrap_or_clone(self)
64    }
65
66    fn from_equivalent(object: T) -> Self {
67        Arc::new(object)
68    }
69}