object_rainbow/impls/
arc.rs1use 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: ?Sized + InlineOutput> InlineOutput for Arc<T> {}
10
11impl<T: Parse<I>, I: ParseInput> Parse<I> for Arc<T> {
12 fn parse(input: I) -> crate::Result<Self> {
13 T::parse(input).map(Self::new)
14 }
15}
16
17impl<T: ParseInline<I>, I: ParseInput> ParseInline<I> for Arc<T> {
18 fn parse_inline(input: &mut I) -> crate::Result<Self> {
19 T::parse_inline(input).map(Self::new)
20 }
21}
22
23impl<T: ?Sized + ListHashes> ListHashes for Arc<T> {
24 fn list_hashes(&self, f: &mut impl FnMut(Hash)) {
25 (**self).list_hashes(f);
26 }
27
28 fn topology_hash(&self) -> Hash {
29 (**self).topology_hash()
30 }
31
32 fn point_count(&self) -> usize {
33 (**self).point_count()
34 }
35}
36
37impl<T: ?Sized + Topological> Topological for Arc<T> {
38 fn traverse(&self, visitor: &mut impl PointVisitor) {
39 (**self).traverse(visitor);
40 }
41
42 fn topology(&self) -> TopoVec {
43 (**self).topology()
44 }
45}
46
47impl<T: ?Sized + Tagged> Tagged for Arc<T> {
48 const TAGS: Tags = T::TAGS;
49 const HASH: Hash = T::HASH;
50}
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}