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<E>, E: 'static> Topological<E> for Box<T> {
22 fn accept_points(&self, visitor: &mut impl PointVisitor<E>) {
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<E>, E: 'static> Object<E> for Box<T> {}
41impl<T: Inline<E>, E: 'static> Inline<E> for Box<T> {}
42impl<T: ReflessObject> ReflessObject for Box<T> {}
43impl<T: ReflessInline> ReflessInline for Box<T> {}
44
45impl<T: ?Sized + Size> Size for Box<T> {
46 const SIZE: usize = T::SIZE;
47 type Size = T::Size;
48}
49
50impl<T: ?Sized + MaybeHasNiche> MaybeHasNiche for Box<T> {
51 type MnArray = T::MnArray;
52}
53
54impl<T> Equivalent<T> for Box<T> {
55 fn into_equivalent(self) -> T {
56 *self
57 }
58
59 fn from_equivalent(object: T) -> Self {
60 Box::new(object)
61 }
62}