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