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