mirror_mirror/foreign_impls/
mod.rs1use core::convert::Infallible;
2use core::ops::Range;
3use core::ops::RangeFrom;
4use core::ops::RangeFull;
5use core::ops::RangeTo;
6use core::ops::RangeToInclusive;
7
8use crate::__private::*;
9use mirror_mirror_macros::__private_derive_reflect_foreign;
10
11mod array;
12mod boxed;
13mod btree_map;
14mod vec;
15mod via_scalar;
16
17#[cfg(feature = "glam")]
18mod glam;
19#[cfg(feature = "macaw")]
20mod macaw;
21
22__private_derive_reflect_foreign! {
23 #[reflect(opt_out(Clone, Debug), crate_name(crate))]
24 enum Option<T>
25 where
26 T: FromReflect + DescribeType,
27 {
28 None,
29 Some(T),
30 }
31}
32
33__private_derive_reflect_foreign! {
34 #[reflect(opt_out(Clone, Debug), crate_name(crate))]
35 enum Result<T, E>
36 where
37 T: FromReflect + DescribeType,
38 E: FromReflect + DescribeType,
39 {
40 Ok(T),
41 Err(E),
42 }
43}
44
45__private_derive_reflect_foreign! {
46 #[reflect(opt_out(Clone, Debug), crate_name(crate))]
47 struct Range<Idx>
48 where
49 Idx: FromReflect + DescribeType,
50 {
51 start: Idx,
52 end: Idx,
53 }
54}
55
56__private_derive_reflect_foreign! {
57 #[reflect(opt_out(Clone, Debug), crate_name(crate))]
58 struct RangeFrom<Idx>
59 where
60 Idx: FromReflect + DescribeType,
61 {
62 start: Idx,
63 }
64}
65
66__private_derive_reflect_foreign! {
67 #[reflect(crate_name(crate))]
68 struct RangeFull;
69}
70
71__private_derive_reflect_foreign! {
72 #[reflect(opt_out(Clone, Debug), crate_name(crate))]
73 struct RangeToInclusive<Idx>
74 where
75 Idx: FromReflect + DescribeType,
76 {
77 end: Idx,
78 }
79}
80
81__private_derive_reflect_foreign! {
82 #[reflect(opt_out(Clone, Debug), crate_name(crate))]
83 struct RangeTo<Idx>
84 where
85 Idx: FromReflect + DescribeType,
86 {
87 end: Idx,
88 }
89}
90
91impl DescribeType for Infallible {
92 fn build(graph: &mut TypeGraph) -> NodeId {
93 let variants = &[];
94 graph.get_or_build_node_with::<Self, _>(|_graph| {
95 EnumNode::new::<Self>(variants, BTreeMap::from([]), &[])
96 })
97 }
98}
99
100impl Reflect for Infallible {
101 fn as_any(&self) -> &dyn Any {
102 match *self {}
103 }
104
105 fn as_any_mut(&mut self) -> &mut dyn Any {
106 match *self {}
107 }
108
109 fn as_reflect(&self) -> &dyn Reflect {
110 match *self {}
111 }
112
113 fn as_reflect_mut(&mut self) -> &mut dyn Reflect {
114 match *self {}
115 }
116
117 fn type_descriptor(&self) -> Cow<'static, TypeDescriptor> {
118 <Self as DescribeType>::type_descriptor()
119 }
120
121 fn patch(&mut self, _value: &dyn Reflect) {
122 match *self {}
123 }
124
125 fn to_value(&self) -> Value {
126 match *self {}
127 }
128
129 fn clone_reflect(&self) -> Box<dyn Reflect> {
130 match *self {}
131 }
132
133 fn debug(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
134 match *self {}
135 }
136
137 fn reflect_owned(self: Box<Self>) -> ReflectOwned {
138 match *self {}
139 }
140
141 fn reflect_ref(&self) -> ReflectRef<'_> {
142 match *self {}
143 }
144
145 fn reflect_mut(&mut self) -> ReflectMut<'_> {
146 match *self {}
147 }
148}
149
150impl FromReflect for Infallible {
151 fn from_reflect(_reflect: &dyn Reflect) -> Option<Self> {
152 None
153 }
154}
155
156impl Enum for Infallible {
157 fn variant_name(&self) -> &str {
158 match *self {}
159 }
160
161 fn variant_kind(&self) -> VariantKind {
162 match *self {}
163 }
164
165 fn field(&self, _name: &str) -> Option<&dyn Reflect> {
166 match *self {}
167 }
168
169 fn field_mut(&mut self, _name: &str) -> Option<&mut dyn Reflect> {
170 match *self {}
171 }
172
173 fn field_at(&self, _index: usize) -> Option<&dyn Reflect> {
174 match *self {}
175 }
176
177 fn field_at_mut(&mut self, _index: usize) -> Option<&mut dyn Reflect> {
178 match *self {}
179 }
180
181 fn fields(&self) -> crate::enum_::VariantFieldIter<'_> {
182 match *self {}
183 }
184
185 fn fields_mut(&mut self) -> VariantFieldIterMut<'_> {
186 match *self {}
187 }
188
189 fn variants_len(&self) -> usize {
190 match *self {}
191 }
192
193 fn fields_len(&self) -> usize {
194 match *self {}
195 }
196
197 fn name_at(&self, _index: usize) -> Option<&str> {
198 match *self {}
199 }
200}
201
202impl From<Infallible> for Value {
203 fn from(value: Infallible) -> Value {
204 match value {}
205 }
206}