object_rainbow/impls/
arc.rs1use crate::*;
2
3impl<T: ?Sized + ToOutput> ToOutput for Arc<T> {
4 fn to_output(&self, output: &mut impl 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}
70
71impl<T: ?Sized + ByteOrd> ByteOrd for Arc<T> {
72 fn bytes_cmp(&self, other: &Self) -> std::cmp::Ordering {
73 (**self).bytes_cmp(other)
74 }
75}
76
77impl<T: ?Sized + FetchBytes> FetchBytes for Arc<T> {
78 fn fetch_bytes(&'_ self) -> FailFuture<'_, ByteNode> {
79 (**self).fetch_bytes()
80 }
81
82 fn fetch_data(&'_ self) -> FailFuture<'_, Vec<u8>> {
83 (**self).fetch_data()
84 }
85
86 fn fetch_bytes_local(&self) -> Result<Option<ByteNode>> {
87 (**self).fetch_bytes_local()
88 }
89
90 fn fetch_data_local(&self) -> Option<Vec<u8>> {
91 (**self).fetch_data_local()
92 }
93
94 fn as_inner(&self) -> Option<&dyn Any> {
95 (**self).as_inner()
96 }
97
98 fn as_resolve(&self) -> Option<&Arc<dyn Resolve>> {
99 (**self).as_resolve()
100 }
101
102 fn try_unwrap_resolve(self: Arc<Self>) -> Option<Arc<dyn Resolve>> {
103 Arc::try_unwrap(self).ok()?.try_unwrap_resolve()
104 }
105}
106
107impl<T: ?Sized + Singular> Singular for Arc<T> {
108 fn hash(&self) -> Hash {
109 (**self).hash()
110 }
111}