1use bevy_reflect_derive::impl_type_path;
5use variadics_please::all_tuples;
6
7use crate::generics::impl_generic_info_methods;
8use crate::{
9 ty::impl_type_methods, utility::GenericTypePathCell, ApplyError, FromReflect, Generics,
10 GetTypeRegistration, MaybeTyped, PartialReflect, Reflect, ReflectCloneError, ReflectKind,
11 ReflectMut, ReflectOwned, ReflectRef, Type, TypeInfo, TypePath, TypeRegistration, TypeRegistry,
12 Typed, UnnamedField,
13};
14use alloc::{boxed::Box, vec, vec::Vec};
15use core::{
16 any::Any,
17 fmt::{Debug, Formatter},
18 slice::Iter,
19};
20
21pub trait Tuple: PartialReflect {
44 fn field(&self, index: usize) -> Option<&dyn PartialReflect>;
47
48 fn field_mut(&mut self, index: usize) -> Option<&mut dyn PartialReflect>;
51
52 fn field_len(&self) -> usize;
54
55 fn iter_fields(&self) -> TupleFieldIter<'_>;
57
58 fn drain(self: Box<Self>) -> Vec<Box<dyn PartialReflect>>;
60
61 fn to_dynamic_tuple(&self) -> Result<DynamicTuple, ReflectCloneError> {
65 Ok(DynamicTuple {
66 represented_type: self.get_represented_type_info(),
67 fields: self
68 .iter_fields()
69 .map(PartialReflect::to_dynamic)
70 .collect::<Result<_, _>>()?,
71 })
72 }
73
74 fn get_represented_tuple_info(&self) -> Option<&'static TupleInfo> {
76 self.get_represented_type_info()?.as_tuple().ok()
77 }
78}
79
80pub struct TupleFieldIter<'a> {
82 pub(crate) tuple: &'a dyn Tuple,
83 pub(crate) index: usize,
84}
85
86impl<'a> TupleFieldIter<'a> {
87 pub fn new(value: &'a dyn Tuple) -> Self {
89 TupleFieldIter {
90 tuple: value,
91 index: 0,
92 }
93 }
94}
95
96impl<'a> Iterator for TupleFieldIter<'a> {
97 type Item = &'a dyn PartialReflect;
98
99 fn next(&mut self) -> Option<Self::Item> {
100 let value = self.tuple.field(self.index);
101 self.index += value.is_some() as usize;
102 value
103 }
104
105 fn size_hint(&self) -> (usize, Option<usize>) {
106 let remaining = self.tuple.field_len().saturating_sub(self.index);
107 (remaining, Some(remaining))
108 }
109}
110
111impl<'a> ExactSizeIterator for TupleFieldIter<'a> {}
112
113pub trait GetTupleField {
129 fn get_field<T: Reflect>(&self, index: usize) -> Option<&T>;
132
133 fn get_field_mut<T: Reflect>(&mut self, index: usize) -> Option<&mut T>;
136}
137
138impl<S: Tuple> GetTupleField for S {
139 fn get_field<T: Reflect>(&self, index: usize) -> Option<&T> {
140 self.field(index)
141 .and_then(|value| value.try_downcast_ref::<T>())
142 }
143
144 fn get_field_mut<T: Reflect>(&mut self, index: usize) -> Option<&mut T> {
145 self.field_mut(index)
146 .and_then(|value| value.try_downcast_mut::<T>())
147 }
148}
149
150impl GetTupleField for dyn Tuple {
151 fn get_field<T: Reflect>(&self, index: usize) -> Option<&T> {
152 self.field(index)
153 .and_then(|value| value.try_downcast_ref::<T>())
154 }
155
156 fn get_field_mut<T: Reflect>(&mut self, index: usize) -> Option<&mut T> {
157 self.field_mut(index)
158 .and_then(|value| value.try_downcast_mut::<T>())
159 }
160}
161
162#[derive(#[automatically_derived]impl ::core::clone::Clone for TupleInfo {
#[inline]
fn clone(&self) -> Self {
TupleInfo {
ty: ::core::clone::Clone::clone(&self.ty),
generics: ::core::clone::Clone::clone(&self.generics),
fields: ::core::clone::Clone::clone(&self.fields),
docs: ::core::clone::Clone::clone(&self.docs),
}
}
}Clone, #[automatically_derived]impl ::core::fmt::Debug for TupleInfo {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f, "TupleInfo",
"ty", &self.ty, "generics", &self.generics, "fields",
&self.fields, "docs", &&self.docs)
}
}Debug)]
164pub struct TupleInfo {
165 ty: Type,
166 generics: Generics,
167 fields: Box<[UnnamedField]>,
168 #[cfg(feature = "reflect_documentation")]
169 docs: Option<&'static str>,
170}
171
172impl TupleInfo {
173 pub fn new<T: Reflect + TypePath>(fields: &[UnnamedField]) -> Self {
179 Self::from_erased(fields, Type::of::<T>())
180 }
181
182 #[inline(never)]
185 fn from_erased(fields: &[UnnamedField], ty: Type) -> Self {
186 Self {
187 ty,
188 generics: Generics::new(),
189 fields: fields.to_vec().into_boxed_slice(),
190 #[cfg(feature = "reflect_documentation")]
191 docs: None,
192 }
193 }
194
195 #[cfg(feature = "reflect_documentation")]
197 pub fn with_docs(self, docs: Option<&'static str>) -> Self {
198 Self { docs, ..self }
199 }
200
201 pub fn field_at(&self, index: usize) -> Option<&UnnamedField> {
203 self.fields.get(index)
204 }
205
206 pub fn iter(&self) -> Iter<'_, UnnamedField> {
208 self.fields.iter()
209 }
210
211 pub fn field_len(&self) -> usize {
213 self.fields.len()
214 }
215
216 pub fn ty(&self) -> &crate::ty::Type { { &self.ty } }
pub fn type_id(&self) -> ::core::any::TypeId { self.ty().id() }
pub fn type_path(&self) -> &'static str { self.ty().path() }
pub fn type_path_table(&self) -> &crate::type_path::TypePathTable {
&self.ty().type_path_table()
}
pub fn is<T: ::core::any::Any>(&self) -> bool { self.ty().is::<T>() }impl_type_methods!(ty);
217
218 #[cfg(feature = "reflect_documentation")]
220 pub fn docs(&self) -> Option<&'static str> {
221 self.docs
222 }
223
224 pub fn generics(&self) -> &crate::generics::Generics { &self.generics }
pub fn with_generics(mut self, generics: crate::generics::Generics) -> Self {
self.generics = generics;
self
}impl_generic_info_methods!(generics);
225}
226
227#[derive(#[automatically_derived]impl ::core::default::Default for DynamicTuple {
#[inline]
fn default() -> Self {
DynamicTuple {
represented_type: ::core::default::Default::default(),
fields: ::core::default::Default::default(),
}
}
}Default, #[automatically_derived]impl ::core::fmt::Debug for DynamicTuple {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f, "DynamicTuple",
"represented_type", &self.represented_type, "fields",
&&self.fields)
}
}Debug)]
229pub struct DynamicTuple {
230 represented_type: Option<&'static TypeInfo>,
231 fields: Vec<Box<dyn PartialReflect>>,
232}
233
234impl DynamicTuple {
235 pub fn set_represented_type(&mut self, represented_type: Option<&'static TypeInfo>) {
243 if let Some(represented_type) = represented_type {
244 if !#[allow(non_exhaustive_omitted_patterns)] match represented_type {
TypeInfo::Tuple(_) => true,
_ => false,
} {
{
::core::panicking::panic_fmt(format_args!("expected TypeInfo::Tuple but received: {0:?}",
represented_type));
}
};assert!(
245 matches!(represented_type, TypeInfo::Tuple(_)),
246 "expected TypeInfo::Tuple but received: {represented_type:?}"
247 );
248 }
249 self.represented_type = represented_type;
250 }
251
252 pub fn insert_boxed(&mut self, value: Box<dyn PartialReflect>) {
254 self.represented_type = None;
255 self.fields.push(value);
256 }
257
258 pub fn insert<T: PartialReflect>(&mut self, value: T) {
260 self.represented_type = None;
261 self.insert_boxed(Box::new(value));
262 }
263}
264
265impl Tuple for DynamicTuple {
266 #[inline]
267 fn field(&self, index: usize) -> Option<&dyn PartialReflect> {
268 self.fields.get(index).map(|field| &**field)
269 }
270
271 #[inline]
272 fn field_mut(&mut self, index: usize) -> Option<&mut dyn PartialReflect> {
273 self.fields.get_mut(index).map(|field| &mut **field)
274 }
275
276 #[inline]
277 fn field_len(&self) -> usize {
278 self.fields.len()
279 }
280
281 #[inline]
282 fn iter_fields(&self) -> TupleFieldIter<'_> {
283 TupleFieldIter {
284 tuple: self,
285 index: 0,
286 }
287 }
288
289 #[inline]
290 fn drain(self: Box<Self>) -> Vec<Box<dyn PartialReflect>> {
291 self.fields
292 }
293}
294
295impl PartialReflect for DynamicTuple {
296 #[inline]
297 fn get_represented_type_info(&self) -> Option<&'static TypeInfo> {
298 self.represented_type
299 }
300
301 #[inline]
302 fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect> {
303 self
304 }
305
306 fn as_partial_reflect(&self) -> &dyn PartialReflect {
307 self
308 }
309
310 fn as_partial_reflect_mut(&mut self) -> &mut dyn PartialReflect {
311 self
312 }
313
314 fn try_into_reflect(self: Box<Self>) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>> {
315 Err(self)
316 }
317
318 fn try_as_reflect(&self) -> Option<&dyn Reflect> {
319 None
320 }
321
322 fn try_as_reflect_mut(&mut self) -> Option<&mut dyn Reflect> {
323 None
324 }
325
326 fn apply(&mut self, value: &dyn PartialReflect) {
327 tuple_apply(self, value);
328 }
329
330 #[inline]
331 fn reflect_kind(&self) -> ReflectKind {
332 ReflectKind::Tuple
333 }
334
335 #[inline]
336 fn reflect_ref(&self) -> ReflectRef<'_> {
337 ReflectRef::Tuple(self)
338 }
339
340 #[inline]
341 fn reflect_mut(&mut self) -> ReflectMut<'_> {
342 ReflectMut::Tuple(self)
343 }
344
345 #[inline]
346 fn reflect_owned(self: Box<Self>) -> ReflectOwned {
347 ReflectOwned::Tuple(self)
348 }
349
350 fn try_apply(&mut self, value: &dyn PartialReflect) -> Result<(), ApplyError> {
351 tuple_try_apply(self, value)
352 }
353
354 fn reflect_partial_eq(&self, value: &dyn PartialReflect) -> Option<bool> {
355 tuple_partial_eq(self, value)
356 }
357
358 fn reflect_partial_cmp(&self, value: &dyn PartialReflect) -> Option<::core::cmp::Ordering> {
359 tuple_partial_cmp(self, value)
360 }
361
362 fn debug(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
363 f.write_fmt(format_args!("DynamicTuple("))write!(f, "DynamicTuple(")?;
364 tuple_debug(self, f)?;
365 f.write_fmt(format_args!(")"))write!(f, ")")
366 }
367
368 #[inline]
369 fn is_dynamic(&self) -> bool {
370 true
371 }
372}
373
374const _: () =
{
#[allow(deprecated, reason =
"derives on a deprecated type shouldn't be considered a usage")]
impl bevy_reflect::TypePath for DynamicTuple where {
fn type_path() -> &'static str { "bevy_reflect::DynamicTuple" }
fn short_type_path() -> &'static str { "DynamicTuple" }
fn type_ident() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("DynamicTuple")
}
fn crate_name() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("bevy_reflect")
}
fn module_path() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("bevy_reflect")
}
}
};impl_type_path!((in bevy_reflect) DynamicTuple);
375
376impl FromIterator<Box<dyn PartialReflect>> for DynamicTuple {
377 fn from_iter<I: IntoIterator<Item = Box<dyn PartialReflect>>>(fields: I) -> Self {
378 Self {
379 represented_type: None,
380 fields: fields.into_iter().collect(),
381 }
382 }
383}
384
385impl IntoIterator for DynamicTuple {
386 type Item = Box<dyn PartialReflect>;
387 type IntoIter = vec::IntoIter<Self::Item>;
388
389 fn into_iter(self) -> Self::IntoIter {
390 self.fields.into_iter()
391 }
392}
393
394impl<'a> IntoIterator for &'a DynamicTuple {
395 type Item = &'a dyn PartialReflect;
396 type IntoIter = TupleFieldIter<'a>;
397
398 fn into_iter(self) -> Self::IntoIter {
399 self.iter_fields()
400 }
401}
402
403#[inline]
409pub fn tuple_apply<T: Tuple>(a: &mut T, b: &dyn PartialReflect) {
410 if let Err(err) = tuple_try_apply(a, b) {
411 { ::core::panicking::panic_fmt(format_args!("{0}", err)); };panic!("{err}");
412 }
413}
414
415#[inline]
423pub fn tuple_try_apply<T: Tuple>(a: &mut T, b: &dyn PartialReflect) -> Result<(), ApplyError> {
424 let tuple = b.reflect_ref().as_tuple()?;
425
426 for (i, value) in tuple.iter_fields().enumerate() {
427 if let Some(v) = a.field_mut(i) {
428 v.try_apply(value)?;
429 }
430 }
431
432 Ok(())
433}
434
435#[inline]
444pub fn tuple_partial_eq<T: Tuple + ?Sized>(a: &T, b: &dyn PartialReflect) -> Option<bool> {
445 let ReflectRef::Tuple(b) = b.reflect_ref() else {
446 return Some(false);
447 };
448
449 if a.field_len() != b.field_len() {
450 return Some(false);
451 }
452
453 for (a_field, b_field) in a.iter_fields().zip(b.iter_fields()) {
454 let eq_result = a_field.reflect_partial_eq(b_field);
455 if let failed @ (Some(false) | None) = eq_result {
456 return failed;
457 }
458 }
459
460 Some(true)
461}
462
463#[inline]
468pub fn tuple_partial_cmp<T: Tuple + ?Sized>(
469 a: &T,
470 b: &dyn PartialReflect,
471) -> Option<::core::cmp::Ordering> {
472 let ReflectRef::Tuple(b) = b.reflect_ref() else {
473 return None;
474 };
475 if a.field_len() != b.field_len() {
476 return None;
477 }
478
479 for (a_field, b_field) in a.iter_fields().zip(b.iter_fields()) {
480 match a_field.reflect_partial_cmp(b_field) {
481 None => return None,
482 Some(core::cmp::Ordering::Equal) => continue,
483 Some(ord) => return Some(ord),
484 }
485 }
486
487 Some(core::cmp::Ordering::Equal)
488}
489
490#[inline]
508pub fn tuple_debug(dyn_tuple: &dyn Tuple, f: &mut Formatter<'_>) -> core::fmt::Result {
509 let mut debug = f.debug_tuple("");
510 for field in dyn_tuple.iter_fields() {
511 debug.field(&field as &dyn Debug);
512 }
513 debug.finish()
514}
515
516macro_rules! impl_reflect_tuple {
517 {$($index:tt : $name:tt),*} => {
518 impl<$($name: Reflect + MaybeTyped + TypePath + GetTypeRegistration),*> Tuple for ($($name,)*) {
519 #[inline]
520 fn field(&self, index: usize) -> Option<&dyn PartialReflect> {
521 match index {
522 $($index => Some(&self.$index as &dyn PartialReflect),)*
523 _ => None,
524 }
525 }
526
527 #[inline]
528 fn field_mut(&mut self, index: usize) -> Option<&mut dyn PartialReflect> {
529 match index {
530 $($index => Some(&mut self.$index as &mut dyn PartialReflect),)*
531 _ => None,
532 }
533 }
534
535 #[inline]
536 fn field_len(&self) -> usize {
537 let indices: &[usize] = &[$($index as usize),*];
538 indices.len()
539 }
540
541 #[inline]
542 fn iter_fields(&self) -> TupleFieldIter<'_> {
543 TupleFieldIter {
544 tuple: self,
545 index: 0,
546 }
547 }
548
549 #[inline]
550 fn drain(self: Box<Self>) -> Vec<Box<dyn PartialReflect>> {
551 vec![
552 $(Box::new(self.$index),)*
553 ]
554 }
555 }
556
557 impl<$($name: Reflect + MaybeTyped + TypePath + GetTypeRegistration),*> PartialReflect for ($($name,)*) {
558 fn get_represented_type_info(&self) -> Option<&'static TypeInfo> {
559 Some(<Self as Typed>::type_info())
560 }
561
562 #[inline]
563 fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect> {
564 self
565 }
566
567 fn as_partial_reflect(&self) -> &dyn PartialReflect {
568 self
569 }
570
571 fn as_partial_reflect_mut(&mut self) -> &mut dyn PartialReflect {
572 self
573 }
574
575 fn try_into_reflect(self: Box<Self>) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>> {
576 Ok(self)
577 }
578
579 fn try_as_reflect(&self) -> Option<&dyn Reflect> {
580 Some(self)
581 }
582
583 fn try_as_reflect_mut(&mut self) -> Option<&mut dyn Reflect> {
584 Some(self)
585 }
586
587 fn reflect_kind(&self) -> ReflectKind {
588 ReflectKind::Tuple
589 }
590
591 fn reflect_ref(&self) -> ReflectRef <'_> {
592 ReflectRef::Tuple(self)
593 }
594
595 fn reflect_mut(&mut self) -> ReflectMut <'_> {
596 ReflectMut::Tuple(self)
597 }
598
599 fn reflect_owned(self: Box<Self>) -> ReflectOwned {
600 ReflectOwned::Tuple(self)
601 }
602
603 fn reflect_partial_eq(&self, value: &dyn PartialReflect) -> Option<bool> {
604 crate::tuple::tuple_partial_eq(self, value)
605 }
606 fn reflect_partial_cmp(&self, value: &dyn PartialReflect) -> Option<::core::cmp::Ordering> {
607 crate::tuple::tuple_partial_cmp(self, value)
608 }
609
610 fn apply(&mut self, value: &dyn PartialReflect) {
611 crate::tuple::tuple_apply(self, value);
612 }
613
614 fn try_apply(&mut self, value: &dyn PartialReflect) -> Result<(), ApplyError> {
615 crate::tuple::tuple_try_apply(self, value)
616 }
617
618 fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError> {
619 Ok(Box::new((
620 $(
621 self.$index.reflect_clone()?
622 .take::<$name>()
623 .expect("`Reflect::reflect_clone` should return the same type"),
624 )*
625 )))
626 }
627 }
628
629 impl<$($name: Reflect + MaybeTyped + TypePath + GetTypeRegistration),*> Reflect for ($($name,)*) {
630 fn into_any(self: Box<Self>) -> Box<dyn Any> {
631 self
632 }
633
634 fn as_any(&self) -> &dyn Any {
635 self
636 }
637
638 fn as_any_mut(&mut self) -> &mut dyn Any {
639 self
640 }
641
642 fn into_reflect(self: Box<Self>) -> Box<dyn Reflect> {
643 self
644 }
645
646 fn as_reflect(&self) -> &dyn Reflect {
647 self
648 }
649
650 fn as_reflect_mut(&mut self) -> &mut dyn Reflect {
651 self
652 }
653
654 fn set(&mut self, value: Box<dyn Reflect>) -> Result<(), Box<dyn Reflect>> {
655 *self = value.take()?;
656 Ok(())
657 }
658 }
659
660 impl <$($name: Reflect + MaybeTyped + TypePath + GetTypeRegistration),*> Typed for ($($name,)*) {
661 fn type_info() -> &'static TypeInfo {
662 static CELL: $crate::utility::GenericTypeInfoCell = $crate::utility::GenericTypeInfoCell::new();
663 CELL.get_or_insert::<Self, _>(|| {
664 let fields = [
665 $(UnnamedField::new::<$name>($index),)*
666 ];
667 let info = TupleInfo::new::<Self>(&fields);
668 TypeInfo::Tuple(info)
669 })
670 }
671 }
672
673 impl<$($name: Reflect + MaybeTyped + TypePath + GetTypeRegistration),*> GetTypeRegistration for ($($name,)*) {
674 fn get_type_registration() -> TypeRegistration {
675 TypeRegistration::of::<($($name,)*)>()
676 }
677
678 fn register_type_dependencies(_registry: &mut TypeRegistry) {
679 $(_registry.register::<$name>();)*
680 }
681 }
682
683 impl<$($name: FromReflect + MaybeTyped + TypePath + GetTypeRegistration),*> FromReflect for ($($name,)*)
684 {
685 fn from_reflect(reflect: &dyn PartialReflect) -> Option<Self> {
686 let _ref_tuple = reflect.reflect_ref().as_tuple().ok()?;
687
688 Some(
689 (
690 $(
691 <$name as FromReflect>::from_reflect(_ref_tuple.field($index)?)?,
692 )*
693 )
694 )
695 }
696 }
697 }
698}
699
700impl Tuple for () {
#[inline]
fn field(&self, index: usize) -> Option<&dyn PartialReflect> {
match index { _ => None, }
}
#[inline]
fn field_mut(&mut self, index: usize) -> Option<&mut dyn PartialReflect> {
match index { _ => None, }
}
#[inline]
fn field_len(&self) -> usize {
let indices: &[usize] = &[];
indices.len()
}
#[inline]
fn iter_fields(&self) -> TupleFieldIter<'_> {
TupleFieldIter { tuple: self, index: 0 }
}
#[inline]
fn drain(self: Box<Self>) -> Vec<Box<dyn PartialReflect>> {
::alloc::vec::Vec::new()
}
}
impl PartialReflect for () {
fn get_represented_type_info(&self) -> Option<&'static TypeInfo> {
Some(<Self as Typed>::type_info())
}
#[inline]
fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect> {
self
}
fn as_partial_reflect(&self) -> &dyn PartialReflect { self }
fn as_partial_reflect_mut(&mut self) -> &mut dyn PartialReflect { self }
fn try_into_reflect(self: Box<Self>)
-> Result<Box<dyn Reflect>, Box<dyn PartialReflect>> {
Ok(self)
}
fn try_as_reflect(&self) -> Option<&dyn Reflect> { Some(self) }
fn try_as_reflect_mut(&mut self) -> Option<&mut dyn Reflect> {
Some(self)
}
fn reflect_kind(&self) -> ReflectKind { ReflectKind::Tuple }
fn reflect_ref(&self) -> ReflectRef<'_> { ReflectRef::Tuple(self) }
fn reflect_mut(&mut self) -> ReflectMut<'_> { ReflectMut::Tuple(self) }
fn reflect_owned(self: Box<Self>) -> ReflectOwned {
ReflectOwned::Tuple(self)
}
fn reflect_partial_eq(&self, value: &dyn PartialReflect) -> Option<bool> {
crate::tuple::tuple_partial_eq(self, value)
}
fn reflect_partial_cmp(&self, value: &dyn PartialReflect)
-> Option<::core::cmp::Ordering> {
crate::tuple::tuple_partial_cmp(self, value)
}
fn apply(&mut self, value: &dyn PartialReflect) {
crate::tuple::tuple_apply(self, value);
}
fn try_apply(&mut self, value: &dyn PartialReflect)
-> Result<(), ApplyError> {
crate::tuple::tuple_try_apply(self, value)
}
fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError> {
Ok(Box::new(()))
}
}
impl Reflect for () {
fn into_any(self: Box<Self>) -> Box<dyn Any> { self }
fn as_any(&self) -> &dyn Any { self }
fn as_any_mut(&mut self) -> &mut dyn Any { self }
fn into_reflect(self: Box<Self>) -> Box<dyn Reflect> { self }
fn as_reflect(&self) -> &dyn Reflect { self }
fn as_reflect_mut(&mut self) -> &mut dyn Reflect { self }
fn set(&mut self, value: Box<dyn Reflect>)
-> Result<(), Box<dyn Reflect>> {
*self = value.take()?;
Ok(())
}
}
impl Typed for () {
fn type_info() -> &'static TypeInfo {
static CELL: crate::utility::GenericTypeInfoCell =
crate::utility::GenericTypeInfoCell::new();
CELL.get_or_insert::<Self,
_>(||
{
let fields = [];
let info = TupleInfo::new::<Self>(&fields);
TypeInfo::Tuple(info)
})
}
}
impl GetTypeRegistration for () {
fn get_type_registration() -> TypeRegistration {
TypeRegistration::of::<()>()
}
fn register_type_dependencies(_registry: &mut TypeRegistry) {}
}
impl FromReflect for () {
fn from_reflect(reflect: &dyn PartialReflect) -> Option<Self> {
let _ref_tuple = reflect.reflect_ref().as_tuple().ok()?;
Some(())
}
}impl_reflect_tuple! {}
701
702impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration> Tuple for (A,)
{
#[inline]
fn field(&self, index: usize) -> Option<&dyn PartialReflect> {
match index { 0 => Some(&self.0 as &dyn PartialReflect), _ => None, }
}
#[inline]
fn field_mut(&mut self, index: usize) -> Option<&mut dyn PartialReflect> {
match index {
0 => Some(&mut self.0 as &mut dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_len(&self) -> usize {
let indices: &[usize] = &[0 as usize];
indices.len()
}
#[inline]
fn iter_fields(&self) -> TupleFieldIter<'_> {
TupleFieldIter { tuple: self, index: 0 }
}
#[inline]
fn drain(self: Box<Self>) -> Vec<Box<dyn PartialReflect>> {
::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
[Box::new(self.0)]))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration> PartialReflect
for (A,) {
fn get_represented_type_info(&self) -> Option<&'static TypeInfo> {
Some(<Self as Typed>::type_info())
}
#[inline]
fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect> {
self
}
fn as_partial_reflect(&self) -> &dyn PartialReflect { self }
fn as_partial_reflect_mut(&mut self) -> &mut dyn PartialReflect { self }
fn try_into_reflect(self: Box<Self>)
-> Result<Box<dyn Reflect>, Box<dyn PartialReflect>> {
Ok(self)
}
fn try_as_reflect(&self) -> Option<&dyn Reflect> { Some(self) }
fn try_as_reflect_mut(&mut self) -> Option<&mut dyn Reflect> {
Some(self)
}
fn reflect_kind(&self) -> ReflectKind { ReflectKind::Tuple }
fn reflect_ref(&self) -> ReflectRef<'_> { ReflectRef::Tuple(self) }
fn reflect_mut(&mut self) -> ReflectMut<'_> { ReflectMut::Tuple(self) }
fn reflect_owned(self: Box<Self>) -> ReflectOwned {
ReflectOwned::Tuple(self)
}
fn reflect_partial_eq(&self, value: &dyn PartialReflect) -> Option<bool> {
crate::tuple::tuple_partial_eq(self, value)
}
fn reflect_partial_cmp(&self, value: &dyn PartialReflect)
-> Option<::core::cmp::Ordering> {
crate::tuple::tuple_partial_cmp(self, value)
}
fn apply(&mut self, value: &dyn PartialReflect) {
crate::tuple::tuple_apply(self, value);
}
fn try_apply(&mut self, value: &dyn PartialReflect)
-> Result<(), ApplyError> {
crate::tuple::tuple_try_apply(self, value)
}
fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError> {
Ok(Box::new((self.0.reflect_clone()?.take::<A>().expect("`Reflect::reflect_clone` should return the same type"),)))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration> Reflect for
(A,) {
fn into_any(self: Box<Self>) -> Box<dyn Any> { self }
fn as_any(&self) -> &dyn Any { self }
fn as_any_mut(&mut self) -> &mut dyn Any { self }
fn into_reflect(self: Box<Self>) -> Box<dyn Reflect> { self }
fn as_reflect(&self) -> &dyn Reflect { self }
fn as_reflect_mut(&mut self) -> &mut dyn Reflect { self }
fn set(&mut self, value: Box<dyn Reflect>)
-> Result<(), Box<dyn Reflect>> {
*self = value.take()?;
Ok(())
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration> Typed for (A,)
{
fn type_info() -> &'static TypeInfo {
static CELL: crate::utility::GenericTypeInfoCell =
crate::utility::GenericTypeInfoCell::new();
CELL.get_or_insert::<Self,
_>(||
{
let fields = [UnnamedField::new::<A>(0)];
let info = TupleInfo::new::<Self>(&fields);
TypeInfo::Tuple(info)
})
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration>
GetTypeRegistration for (A,) {
fn get_type_registration() -> TypeRegistration {
TypeRegistration::of::<(A,)>()
}
fn register_type_dependencies(_registry: &mut TypeRegistry) {
_registry.register::<A>();
}
}
impl<A: FromReflect + MaybeTyped + TypePath + GetTypeRegistration> FromReflect
for (A,) {
fn from_reflect(reflect: &dyn PartialReflect) -> Option<Self> {
let _ref_tuple = reflect.reflect_ref().as_tuple().ok()?;
Some((<A as FromReflect>::from_reflect(_ref_tuple.field(0)?)?,))
}
}impl_reflect_tuple! {0: A}
703
704impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration> Tuple for (A, B) {
#[inline]
fn field(&self, index: usize) -> Option<&dyn PartialReflect> {
match index {
0 => Some(&self.0 as &dyn PartialReflect),
1 => Some(&self.1 as &dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_mut(&mut self, index: usize) -> Option<&mut dyn PartialReflect> {
match index {
0 => Some(&mut self.0 as &mut dyn PartialReflect),
1 => Some(&mut self.1 as &mut dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_len(&self) -> usize {
let indices: &[usize] = &[0 as usize, 1 as usize];
indices.len()
}
#[inline]
fn iter_fields(&self) -> TupleFieldIter<'_> {
TupleFieldIter { tuple: self, index: 0 }
}
#[inline]
fn drain(self: Box<Self>) -> Vec<Box<dyn PartialReflect>> {
::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
[Box::new(self.0), Box::new(self.1)]))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration> PartialReflect for (A, B) {
fn get_represented_type_info(&self) -> Option<&'static TypeInfo> {
Some(<Self as Typed>::type_info())
}
#[inline]
fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect> {
self
}
fn as_partial_reflect(&self) -> &dyn PartialReflect { self }
fn as_partial_reflect_mut(&mut self) -> &mut dyn PartialReflect { self }
fn try_into_reflect(self: Box<Self>)
-> Result<Box<dyn Reflect>, Box<dyn PartialReflect>> {
Ok(self)
}
fn try_as_reflect(&self) -> Option<&dyn Reflect> { Some(self) }
fn try_as_reflect_mut(&mut self) -> Option<&mut dyn Reflect> {
Some(self)
}
fn reflect_kind(&self) -> ReflectKind { ReflectKind::Tuple }
fn reflect_ref(&self) -> ReflectRef<'_> { ReflectRef::Tuple(self) }
fn reflect_mut(&mut self) -> ReflectMut<'_> { ReflectMut::Tuple(self) }
fn reflect_owned(self: Box<Self>) -> ReflectOwned {
ReflectOwned::Tuple(self)
}
fn reflect_partial_eq(&self, value: &dyn PartialReflect) -> Option<bool> {
crate::tuple::tuple_partial_eq(self, value)
}
fn reflect_partial_cmp(&self, value: &dyn PartialReflect)
-> Option<::core::cmp::Ordering> {
crate::tuple::tuple_partial_cmp(self, value)
}
fn apply(&mut self, value: &dyn PartialReflect) {
crate::tuple::tuple_apply(self, value);
}
fn try_apply(&mut self, value: &dyn PartialReflect)
-> Result<(), ApplyError> {
crate::tuple::tuple_try_apply(self, value)
}
fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError> {
Ok(Box::new((self.0.reflect_clone()?.take::<A>().expect("`Reflect::reflect_clone` should return the same type"),
self.1.reflect_clone()?.take::<B>().expect("`Reflect::reflect_clone` should return the same type"))))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration> Reflect for (A, B) {
fn into_any(self: Box<Self>) -> Box<dyn Any> { self }
fn as_any(&self) -> &dyn Any { self }
fn as_any_mut(&mut self) -> &mut dyn Any { self }
fn into_reflect(self: Box<Self>) -> Box<dyn Reflect> { self }
fn as_reflect(&self) -> &dyn Reflect { self }
fn as_reflect_mut(&mut self) -> &mut dyn Reflect { self }
fn set(&mut self, value: Box<dyn Reflect>)
-> Result<(), Box<dyn Reflect>> {
*self = value.take()?;
Ok(())
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration> Typed for (A, B) {
fn type_info() -> &'static TypeInfo {
static CELL: crate::utility::GenericTypeInfoCell =
crate::utility::GenericTypeInfoCell::new();
CELL.get_or_insert::<Self,
_>(||
{
let fields =
[UnnamedField::new::<A>(0), UnnamedField::new::<B>(1)];
let info = TupleInfo::new::<Self>(&fields);
TypeInfo::Tuple(info)
})
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration> GetTypeRegistration for
(A, B) {
fn get_type_registration() -> TypeRegistration {
TypeRegistration::of::<(A, B)>()
}
fn register_type_dependencies(_registry: &mut TypeRegistry) {
_registry.register::<A>();
_registry.register::<B>();
}
}
impl<A: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
B: FromReflect + MaybeTyped + TypePath + GetTypeRegistration> FromReflect
for (A, B) {
fn from_reflect(reflect: &dyn PartialReflect) -> Option<Self> {
let _ref_tuple = reflect.reflect_ref().as_tuple().ok()?;
Some((<A as FromReflect>::from_reflect(_ref_tuple.field(0)?)?,
<B as FromReflect>::from_reflect(_ref_tuple.field(1)?)?))
}
}impl_reflect_tuple! {0: A, 1: B}
705
706impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration> Tuple for (A, B, C) {
#[inline]
fn field(&self, index: usize) -> Option<&dyn PartialReflect> {
match index {
0 => Some(&self.0 as &dyn PartialReflect),
1 => Some(&self.1 as &dyn PartialReflect),
2 => Some(&self.2 as &dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_mut(&mut self, index: usize) -> Option<&mut dyn PartialReflect> {
match index {
0 => Some(&mut self.0 as &mut dyn PartialReflect),
1 => Some(&mut self.1 as &mut dyn PartialReflect),
2 => Some(&mut self.2 as &mut dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_len(&self) -> usize {
let indices: &[usize] = &[0 as usize, 1 as usize, 2 as usize];
indices.len()
}
#[inline]
fn iter_fields(&self) -> TupleFieldIter<'_> {
TupleFieldIter { tuple: self, index: 0 }
}
#[inline]
fn drain(self: Box<Self>) -> Vec<Box<dyn PartialReflect>> {
::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
[Box::new(self.0), Box::new(self.1), Box::new(self.2)]))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration> PartialReflect for (A, B, C) {
fn get_represented_type_info(&self) -> Option<&'static TypeInfo> {
Some(<Self as Typed>::type_info())
}
#[inline]
fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect> {
self
}
fn as_partial_reflect(&self) -> &dyn PartialReflect { self }
fn as_partial_reflect_mut(&mut self) -> &mut dyn PartialReflect { self }
fn try_into_reflect(self: Box<Self>)
-> Result<Box<dyn Reflect>, Box<dyn PartialReflect>> {
Ok(self)
}
fn try_as_reflect(&self) -> Option<&dyn Reflect> { Some(self) }
fn try_as_reflect_mut(&mut self) -> Option<&mut dyn Reflect> {
Some(self)
}
fn reflect_kind(&self) -> ReflectKind { ReflectKind::Tuple }
fn reflect_ref(&self) -> ReflectRef<'_> { ReflectRef::Tuple(self) }
fn reflect_mut(&mut self) -> ReflectMut<'_> { ReflectMut::Tuple(self) }
fn reflect_owned(self: Box<Self>) -> ReflectOwned {
ReflectOwned::Tuple(self)
}
fn reflect_partial_eq(&self, value: &dyn PartialReflect) -> Option<bool> {
crate::tuple::tuple_partial_eq(self, value)
}
fn reflect_partial_cmp(&self, value: &dyn PartialReflect)
-> Option<::core::cmp::Ordering> {
crate::tuple::tuple_partial_cmp(self, value)
}
fn apply(&mut self, value: &dyn PartialReflect) {
crate::tuple::tuple_apply(self, value);
}
fn try_apply(&mut self, value: &dyn PartialReflect)
-> Result<(), ApplyError> {
crate::tuple::tuple_try_apply(self, value)
}
fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError> {
Ok(Box::new((self.0.reflect_clone()?.take::<A>().expect("`Reflect::reflect_clone` should return the same type"),
self.1.reflect_clone()?.take::<B>().expect("`Reflect::reflect_clone` should return the same type"),
self.2.reflect_clone()?.take::<C>().expect("`Reflect::reflect_clone` should return the same type"))))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration> Reflect for (A, B, C) {
fn into_any(self: Box<Self>) -> Box<dyn Any> { self }
fn as_any(&self) -> &dyn Any { self }
fn as_any_mut(&mut self) -> &mut dyn Any { self }
fn into_reflect(self: Box<Self>) -> Box<dyn Reflect> { self }
fn as_reflect(&self) -> &dyn Reflect { self }
fn as_reflect_mut(&mut self) -> &mut dyn Reflect { self }
fn set(&mut self, value: Box<dyn Reflect>)
-> Result<(), Box<dyn Reflect>> {
*self = value.take()?;
Ok(())
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration> Typed for (A, B, C) {
fn type_info() -> &'static TypeInfo {
static CELL: crate::utility::GenericTypeInfoCell =
crate::utility::GenericTypeInfoCell::new();
CELL.get_or_insert::<Self,
_>(||
{
let fields =
[UnnamedField::new::<A>(0), UnnamedField::new::<B>(1),
UnnamedField::new::<C>(2)];
let info = TupleInfo::new::<Self>(&fields);
TypeInfo::Tuple(info)
})
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration> GetTypeRegistration for (A, B, C) {
fn get_type_registration() -> TypeRegistration {
TypeRegistration::of::<(A, B, C)>()
}
fn register_type_dependencies(_registry: &mut TypeRegistry) {
_registry.register::<A>();
_registry.register::<B>();
_registry.register::<C>();
}
}
impl<A: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
B: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
C: FromReflect + MaybeTyped + TypePath + GetTypeRegistration> FromReflect
for (A, B, C) {
fn from_reflect(reflect: &dyn PartialReflect) -> Option<Self> {
let _ref_tuple = reflect.reflect_ref().as_tuple().ok()?;
Some((<A as FromReflect>::from_reflect(_ref_tuple.field(0)?)?,
<B as FromReflect>::from_reflect(_ref_tuple.field(1)?)?,
<C as FromReflect>::from_reflect(_ref_tuple.field(2)?)?))
}
}impl_reflect_tuple! {0: A, 1: B, 2: C}
707
708impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Tuple for (A, B, C, D) {
#[inline]
fn field(&self, index: usize) -> Option<&dyn PartialReflect> {
match index {
0 => Some(&self.0 as &dyn PartialReflect),
1 => Some(&self.1 as &dyn PartialReflect),
2 => Some(&self.2 as &dyn PartialReflect),
3 => Some(&self.3 as &dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_mut(&mut self, index: usize) -> Option<&mut dyn PartialReflect> {
match index {
0 => Some(&mut self.0 as &mut dyn PartialReflect),
1 => Some(&mut self.1 as &mut dyn PartialReflect),
2 => Some(&mut self.2 as &mut dyn PartialReflect),
3 => Some(&mut self.3 as &mut dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_len(&self) -> usize {
let indices: &[usize] =
&[0 as usize, 1 as usize, 2 as usize, 3 as usize];
indices.len()
}
#[inline]
fn iter_fields(&self) -> TupleFieldIter<'_> {
TupleFieldIter { tuple: self, index: 0 }
}
#[inline]
fn drain(self: Box<Self>) -> Vec<Box<dyn PartialReflect>> {
::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
[Box::new(self.0), Box::new(self.1), Box::new(self.2),
Box::new(self.3)]))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> PartialReflect for (A, B, C, D) {
fn get_represented_type_info(&self) -> Option<&'static TypeInfo> {
Some(<Self as Typed>::type_info())
}
#[inline]
fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect> {
self
}
fn as_partial_reflect(&self) -> &dyn PartialReflect { self }
fn as_partial_reflect_mut(&mut self) -> &mut dyn PartialReflect { self }
fn try_into_reflect(self: Box<Self>)
-> Result<Box<dyn Reflect>, Box<dyn PartialReflect>> {
Ok(self)
}
fn try_as_reflect(&self) -> Option<&dyn Reflect> { Some(self) }
fn try_as_reflect_mut(&mut self) -> Option<&mut dyn Reflect> {
Some(self)
}
fn reflect_kind(&self) -> ReflectKind { ReflectKind::Tuple }
fn reflect_ref(&self) -> ReflectRef<'_> { ReflectRef::Tuple(self) }
fn reflect_mut(&mut self) -> ReflectMut<'_> { ReflectMut::Tuple(self) }
fn reflect_owned(self: Box<Self>) -> ReflectOwned {
ReflectOwned::Tuple(self)
}
fn reflect_partial_eq(&self, value: &dyn PartialReflect) -> Option<bool> {
crate::tuple::tuple_partial_eq(self, value)
}
fn reflect_partial_cmp(&self, value: &dyn PartialReflect)
-> Option<::core::cmp::Ordering> {
crate::tuple::tuple_partial_cmp(self, value)
}
fn apply(&mut self, value: &dyn PartialReflect) {
crate::tuple::tuple_apply(self, value);
}
fn try_apply(&mut self, value: &dyn PartialReflect)
-> Result<(), ApplyError> {
crate::tuple::tuple_try_apply(self, value)
}
fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError> {
Ok(Box::new((self.0.reflect_clone()?.take::<A>().expect("`Reflect::reflect_clone` should return the same type"),
self.1.reflect_clone()?.take::<B>().expect("`Reflect::reflect_clone` should return the same type"),
self.2.reflect_clone()?.take::<C>().expect("`Reflect::reflect_clone` should return the same type"),
self.3.reflect_clone()?.take::<D>().expect("`Reflect::reflect_clone` should return the same type"))))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Reflect for (A, B, C, D) {
fn into_any(self: Box<Self>) -> Box<dyn Any> { self }
fn as_any(&self) -> &dyn Any { self }
fn as_any_mut(&mut self) -> &mut dyn Any { self }
fn into_reflect(self: Box<Self>) -> Box<dyn Reflect> { self }
fn as_reflect(&self) -> &dyn Reflect { self }
fn as_reflect_mut(&mut self) -> &mut dyn Reflect { self }
fn set(&mut self, value: Box<dyn Reflect>)
-> Result<(), Box<dyn Reflect>> {
*self = value.take()?;
Ok(())
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Typed for (A, B, C, D) {
fn type_info() -> &'static TypeInfo {
static CELL: crate::utility::GenericTypeInfoCell =
crate::utility::GenericTypeInfoCell::new();
CELL.get_or_insert::<Self,
_>(||
{
let fields =
[UnnamedField::new::<A>(0), UnnamedField::new::<B>(1),
UnnamedField::new::<C>(2), UnnamedField::new::<D>(3)];
let info = TupleInfo::new::<Self>(&fields);
TypeInfo::Tuple(info)
})
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> GetTypeRegistration for (A, B, C, D) {
fn get_type_registration() -> TypeRegistration {
TypeRegistration::of::<(A, B, C, D)>()
}
fn register_type_dependencies(_registry: &mut TypeRegistry) {
_registry.register::<A>();
_registry.register::<B>();
_registry.register::<C>();
_registry.register::<D>();
}
}
impl<A: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
B: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
C: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
D: FromReflect + MaybeTyped + TypePath + GetTypeRegistration> FromReflect
for (A, B, C, D) {
fn from_reflect(reflect: &dyn PartialReflect) -> Option<Self> {
let _ref_tuple = reflect.reflect_ref().as_tuple().ok()?;
Some((<A as FromReflect>::from_reflect(_ref_tuple.field(0)?)?,
<B as FromReflect>::from_reflect(_ref_tuple.field(1)?)?,
<C as FromReflect>::from_reflect(_ref_tuple.field(2)?)?,
<D as FromReflect>::from_reflect(_ref_tuple.field(3)?)?))
}
}impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D}
709
710impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Tuple for (A, B, C, D, E) {
#[inline]
fn field(&self, index: usize) -> Option<&dyn PartialReflect> {
match index {
0 => Some(&self.0 as &dyn PartialReflect),
1 => Some(&self.1 as &dyn PartialReflect),
2 => Some(&self.2 as &dyn PartialReflect),
3 => Some(&self.3 as &dyn PartialReflect),
4 => Some(&self.4 as &dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_mut(&mut self, index: usize) -> Option<&mut dyn PartialReflect> {
match index {
0 => Some(&mut self.0 as &mut dyn PartialReflect),
1 => Some(&mut self.1 as &mut dyn PartialReflect),
2 => Some(&mut self.2 as &mut dyn PartialReflect),
3 => Some(&mut self.3 as &mut dyn PartialReflect),
4 => Some(&mut self.4 as &mut dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_len(&self) -> usize {
let indices: &[usize] =
&[0 as usize, 1 as usize, 2 as usize, 3 as usize, 4 as usize];
indices.len()
}
#[inline]
fn iter_fields(&self) -> TupleFieldIter<'_> {
TupleFieldIter { tuple: self, index: 0 }
}
#[inline]
fn drain(self: Box<Self>) -> Vec<Box<dyn PartialReflect>> {
::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
[Box::new(self.0), Box::new(self.1), Box::new(self.2),
Box::new(self.3), Box::new(self.4)]))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> PartialReflect for (A, B, C, D, E) {
fn get_represented_type_info(&self) -> Option<&'static TypeInfo> {
Some(<Self as Typed>::type_info())
}
#[inline]
fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect> {
self
}
fn as_partial_reflect(&self) -> &dyn PartialReflect { self }
fn as_partial_reflect_mut(&mut self) -> &mut dyn PartialReflect { self }
fn try_into_reflect(self: Box<Self>)
-> Result<Box<dyn Reflect>, Box<dyn PartialReflect>> {
Ok(self)
}
fn try_as_reflect(&self) -> Option<&dyn Reflect> { Some(self) }
fn try_as_reflect_mut(&mut self) -> Option<&mut dyn Reflect> {
Some(self)
}
fn reflect_kind(&self) -> ReflectKind { ReflectKind::Tuple }
fn reflect_ref(&self) -> ReflectRef<'_> { ReflectRef::Tuple(self) }
fn reflect_mut(&mut self) -> ReflectMut<'_> { ReflectMut::Tuple(self) }
fn reflect_owned(self: Box<Self>) -> ReflectOwned {
ReflectOwned::Tuple(self)
}
fn reflect_partial_eq(&self, value: &dyn PartialReflect) -> Option<bool> {
crate::tuple::tuple_partial_eq(self, value)
}
fn reflect_partial_cmp(&self, value: &dyn PartialReflect)
-> Option<::core::cmp::Ordering> {
crate::tuple::tuple_partial_cmp(self, value)
}
fn apply(&mut self, value: &dyn PartialReflect) {
crate::tuple::tuple_apply(self, value);
}
fn try_apply(&mut self, value: &dyn PartialReflect)
-> Result<(), ApplyError> {
crate::tuple::tuple_try_apply(self, value)
}
fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError> {
Ok(Box::new((self.0.reflect_clone()?.take::<A>().expect("`Reflect::reflect_clone` should return the same type"),
self.1.reflect_clone()?.take::<B>().expect("`Reflect::reflect_clone` should return the same type"),
self.2.reflect_clone()?.take::<C>().expect("`Reflect::reflect_clone` should return the same type"),
self.3.reflect_clone()?.take::<D>().expect("`Reflect::reflect_clone` should return the same type"),
self.4.reflect_clone()?.take::<E>().expect("`Reflect::reflect_clone` should return the same type"))))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Reflect for (A, B, C, D, E) {
fn into_any(self: Box<Self>) -> Box<dyn Any> { self }
fn as_any(&self) -> &dyn Any { self }
fn as_any_mut(&mut self) -> &mut dyn Any { self }
fn into_reflect(self: Box<Self>) -> Box<dyn Reflect> { self }
fn as_reflect(&self) -> &dyn Reflect { self }
fn as_reflect_mut(&mut self) -> &mut dyn Reflect { self }
fn set(&mut self, value: Box<dyn Reflect>)
-> Result<(), Box<dyn Reflect>> {
*self = value.take()?;
Ok(())
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Typed for (A, B, C, D, E) {
fn type_info() -> &'static TypeInfo {
static CELL: crate::utility::GenericTypeInfoCell =
crate::utility::GenericTypeInfoCell::new();
CELL.get_or_insert::<Self,
_>(||
{
let fields =
[UnnamedField::new::<A>(0), UnnamedField::new::<B>(1),
UnnamedField::new::<C>(2), UnnamedField::new::<D>(3),
UnnamedField::new::<E>(4)];
let info = TupleInfo::new::<Self>(&fields);
TypeInfo::Tuple(info)
})
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> GetTypeRegistration for (A, B, C, D, E) {
fn get_type_registration() -> TypeRegistration {
TypeRegistration::of::<(A, B, C, D, E)>()
}
fn register_type_dependencies(_registry: &mut TypeRegistry) {
_registry.register::<A>();
_registry.register::<B>();
_registry.register::<C>();
_registry.register::<D>();
_registry.register::<E>();
}
}
impl<A: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
B: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
C: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
D: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
E: FromReflect + MaybeTyped + TypePath + GetTypeRegistration> FromReflect
for (A, B, C, D, E) {
fn from_reflect(reflect: &dyn PartialReflect) -> Option<Self> {
let _ref_tuple = reflect.reflect_ref().as_tuple().ok()?;
Some((<A as FromReflect>::from_reflect(_ref_tuple.field(0)?)?,
<B as FromReflect>::from_reflect(_ref_tuple.field(1)?)?,
<C as FromReflect>::from_reflect(_ref_tuple.field(2)?)?,
<D as FromReflect>::from_reflect(_ref_tuple.field(3)?)?,
<E as FromReflect>::from_reflect(_ref_tuple.field(4)?)?))
}
}impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E}
711
712impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Tuple for (A, B, C, D, E, F) {
#[inline]
fn field(&self, index: usize) -> Option<&dyn PartialReflect> {
match index {
0 => Some(&self.0 as &dyn PartialReflect),
1 => Some(&self.1 as &dyn PartialReflect),
2 => Some(&self.2 as &dyn PartialReflect),
3 => Some(&self.3 as &dyn PartialReflect),
4 => Some(&self.4 as &dyn PartialReflect),
5 => Some(&self.5 as &dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_mut(&mut self, index: usize) -> Option<&mut dyn PartialReflect> {
match index {
0 => Some(&mut self.0 as &mut dyn PartialReflect),
1 => Some(&mut self.1 as &mut dyn PartialReflect),
2 => Some(&mut self.2 as &mut dyn PartialReflect),
3 => Some(&mut self.3 as &mut dyn PartialReflect),
4 => Some(&mut self.4 as &mut dyn PartialReflect),
5 => Some(&mut self.5 as &mut dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_len(&self) -> usize {
let indices: &[usize] =
&[0 as usize, 1 as usize, 2 as usize, 3 as usize, 4 as usize,
5 as usize];
indices.len()
}
#[inline]
fn iter_fields(&self) -> TupleFieldIter<'_> {
TupleFieldIter { tuple: self, index: 0 }
}
#[inline]
fn drain(self: Box<Self>) -> Vec<Box<dyn PartialReflect>> {
::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
[Box::new(self.0), Box::new(self.1), Box::new(self.2),
Box::new(self.3), Box::new(self.4), Box::new(self.5)]))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> PartialReflect for (A, B, C, D, E, F) {
fn get_represented_type_info(&self) -> Option<&'static TypeInfo> {
Some(<Self as Typed>::type_info())
}
#[inline]
fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect> {
self
}
fn as_partial_reflect(&self) -> &dyn PartialReflect { self }
fn as_partial_reflect_mut(&mut self) -> &mut dyn PartialReflect { self }
fn try_into_reflect(self: Box<Self>)
-> Result<Box<dyn Reflect>, Box<dyn PartialReflect>> {
Ok(self)
}
fn try_as_reflect(&self) -> Option<&dyn Reflect> { Some(self) }
fn try_as_reflect_mut(&mut self) -> Option<&mut dyn Reflect> {
Some(self)
}
fn reflect_kind(&self) -> ReflectKind { ReflectKind::Tuple }
fn reflect_ref(&self) -> ReflectRef<'_> { ReflectRef::Tuple(self) }
fn reflect_mut(&mut self) -> ReflectMut<'_> { ReflectMut::Tuple(self) }
fn reflect_owned(self: Box<Self>) -> ReflectOwned {
ReflectOwned::Tuple(self)
}
fn reflect_partial_eq(&self, value: &dyn PartialReflect) -> Option<bool> {
crate::tuple::tuple_partial_eq(self, value)
}
fn reflect_partial_cmp(&self, value: &dyn PartialReflect)
-> Option<::core::cmp::Ordering> {
crate::tuple::tuple_partial_cmp(self, value)
}
fn apply(&mut self, value: &dyn PartialReflect) {
crate::tuple::tuple_apply(self, value);
}
fn try_apply(&mut self, value: &dyn PartialReflect)
-> Result<(), ApplyError> {
crate::tuple::tuple_try_apply(self, value)
}
fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError> {
Ok(Box::new((self.0.reflect_clone()?.take::<A>().expect("`Reflect::reflect_clone` should return the same type"),
self.1.reflect_clone()?.take::<B>().expect("`Reflect::reflect_clone` should return the same type"),
self.2.reflect_clone()?.take::<C>().expect("`Reflect::reflect_clone` should return the same type"),
self.3.reflect_clone()?.take::<D>().expect("`Reflect::reflect_clone` should return the same type"),
self.4.reflect_clone()?.take::<E>().expect("`Reflect::reflect_clone` should return the same type"),
self.5.reflect_clone()?.take::<F>().expect("`Reflect::reflect_clone` should return the same type"))))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Reflect for (A, B, C, D, E, F) {
fn into_any(self: Box<Self>) -> Box<dyn Any> { self }
fn as_any(&self) -> &dyn Any { self }
fn as_any_mut(&mut self) -> &mut dyn Any { self }
fn into_reflect(self: Box<Self>) -> Box<dyn Reflect> { self }
fn as_reflect(&self) -> &dyn Reflect { self }
fn as_reflect_mut(&mut self) -> &mut dyn Reflect { self }
fn set(&mut self, value: Box<dyn Reflect>)
-> Result<(), Box<dyn Reflect>> {
*self = value.take()?;
Ok(())
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Typed for (A, B, C, D, E, F) {
fn type_info() -> &'static TypeInfo {
static CELL: crate::utility::GenericTypeInfoCell =
crate::utility::GenericTypeInfoCell::new();
CELL.get_or_insert::<Self,
_>(||
{
let fields =
[UnnamedField::new::<A>(0), UnnamedField::new::<B>(1),
UnnamedField::new::<C>(2), UnnamedField::new::<D>(3),
UnnamedField::new::<E>(4), UnnamedField::new::<F>(5)];
let info = TupleInfo::new::<Self>(&fields);
TypeInfo::Tuple(info)
})
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> GetTypeRegistration for (A, B, C, D, E, F) {
fn get_type_registration() -> TypeRegistration {
TypeRegistration::of::<(A, B, C, D, E, F)>()
}
fn register_type_dependencies(_registry: &mut TypeRegistry) {
_registry.register::<A>();
_registry.register::<B>();
_registry.register::<C>();
_registry.register::<D>();
_registry.register::<E>();
_registry.register::<F>();
}
}
impl<A: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
B: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
C: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
D: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
E: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
F: FromReflect + MaybeTyped + TypePath + GetTypeRegistration> FromReflect
for (A, B, C, D, E, F) {
fn from_reflect(reflect: &dyn PartialReflect) -> Option<Self> {
let _ref_tuple = reflect.reflect_ref().as_tuple().ok()?;
Some((<A as FromReflect>::from_reflect(_ref_tuple.field(0)?)?,
<B as FromReflect>::from_reflect(_ref_tuple.field(1)?)?,
<C as FromReflect>::from_reflect(_ref_tuple.field(2)?)?,
<D as FromReflect>::from_reflect(_ref_tuple.field(3)?)?,
<E as FromReflect>::from_reflect(_ref_tuple.field(4)?)?,
<F as FromReflect>::from_reflect(_ref_tuple.field(5)?)?))
}
}impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F}
713
714impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Tuple for (A, B, C, D, E, F, G) {
#[inline]
fn field(&self, index: usize) -> Option<&dyn PartialReflect> {
match index {
0 => Some(&self.0 as &dyn PartialReflect),
1 => Some(&self.1 as &dyn PartialReflect),
2 => Some(&self.2 as &dyn PartialReflect),
3 => Some(&self.3 as &dyn PartialReflect),
4 => Some(&self.4 as &dyn PartialReflect),
5 => Some(&self.5 as &dyn PartialReflect),
6 => Some(&self.6 as &dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_mut(&mut self, index: usize) -> Option<&mut dyn PartialReflect> {
match index {
0 => Some(&mut self.0 as &mut dyn PartialReflect),
1 => Some(&mut self.1 as &mut dyn PartialReflect),
2 => Some(&mut self.2 as &mut dyn PartialReflect),
3 => Some(&mut self.3 as &mut dyn PartialReflect),
4 => Some(&mut self.4 as &mut dyn PartialReflect),
5 => Some(&mut self.5 as &mut dyn PartialReflect),
6 => Some(&mut self.6 as &mut dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_len(&self) -> usize {
let indices: &[usize] =
&[0 as usize, 1 as usize, 2 as usize, 3 as usize, 4 as usize,
5 as usize, 6 as usize];
indices.len()
}
#[inline]
fn iter_fields(&self) -> TupleFieldIter<'_> {
TupleFieldIter { tuple: self, index: 0 }
}
#[inline]
fn drain(self: Box<Self>) -> Vec<Box<dyn PartialReflect>> {
::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
[Box::new(self.0), Box::new(self.1), Box::new(self.2),
Box::new(self.3), Box::new(self.4), Box::new(self.5),
Box::new(self.6)]))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> PartialReflect for (A, B, C, D, E, F, G) {
fn get_represented_type_info(&self) -> Option<&'static TypeInfo> {
Some(<Self as Typed>::type_info())
}
#[inline]
fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect> {
self
}
fn as_partial_reflect(&self) -> &dyn PartialReflect { self }
fn as_partial_reflect_mut(&mut self) -> &mut dyn PartialReflect { self }
fn try_into_reflect(self: Box<Self>)
-> Result<Box<dyn Reflect>, Box<dyn PartialReflect>> {
Ok(self)
}
fn try_as_reflect(&self) -> Option<&dyn Reflect> { Some(self) }
fn try_as_reflect_mut(&mut self) -> Option<&mut dyn Reflect> {
Some(self)
}
fn reflect_kind(&self) -> ReflectKind { ReflectKind::Tuple }
fn reflect_ref(&self) -> ReflectRef<'_> { ReflectRef::Tuple(self) }
fn reflect_mut(&mut self) -> ReflectMut<'_> { ReflectMut::Tuple(self) }
fn reflect_owned(self: Box<Self>) -> ReflectOwned {
ReflectOwned::Tuple(self)
}
fn reflect_partial_eq(&self, value: &dyn PartialReflect) -> Option<bool> {
crate::tuple::tuple_partial_eq(self, value)
}
fn reflect_partial_cmp(&self, value: &dyn PartialReflect)
-> Option<::core::cmp::Ordering> {
crate::tuple::tuple_partial_cmp(self, value)
}
fn apply(&mut self, value: &dyn PartialReflect) {
crate::tuple::tuple_apply(self, value);
}
fn try_apply(&mut self, value: &dyn PartialReflect)
-> Result<(), ApplyError> {
crate::tuple::tuple_try_apply(self, value)
}
fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError> {
Ok(Box::new((self.0.reflect_clone()?.take::<A>().expect("`Reflect::reflect_clone` should return the same type"),
self.1.reflect_clone()?.take::<B>().expect("`Reflect::reflect_clone` should return the same type"),
self.2.reflect_clone()?.take::<C>().expect("`Reflect::reflect_clone` should return the same type"),
self.3.reflect_clone()?.take::<D>().expect("`Reflect::reflect_clone` should return the same type"),
self.4.reflect_clone()?.take::<E>().expect("`Reflect::reflect_clone` should return the same type"),
self.5.reflect_clone()?.take::<F>().expect("`Reflect::reflect_clone` should return the same type"),
self.6.reflect_clone()?.take::<G>().expect("`Reflect::reflect_clone` should return the same type"))))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Reflect for (A, B, C, D, E, F, G) {
fn into_any(self: Box<Self>) -> Box<dyn Any> { self }
fn as_any(&self) -> &dyn Any { self }
fn as_any_mut(&mut self) -> &mut dyn Any { self }
fn into_reflect(self: Box<Self>) -> Box<dyn Reflect> { self }
fn as_reflect(&self) -> &dyn Reflect { self }
fn as_reflect_mut(&mut self) -> &mut dyn Reflect { self }
fn set(&mut self, value: Box<dyn Reflect>)
-> Result<(), Box<dyn Reflect>> {
*self = value.take()?;
Ok(())
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Typed for (A, B, C, D, E, F, G) {
fn type_info() -> &'static TypeInfo {
static CELL: crate::utility::GenericTypeInfoCell =
crate::utility::GenericTypeInfoCell::new();
CELL.get_or_insert::<Self,
_>(||
{
let fields =
[UnnamedField::new::<A>(0), UnnamedField::new::<B>(1),
UnnamedField::new::<C>(2), UnnamedField::new::<D>(3),
UnnamedField::new::<E>(4), UnnamedField::new::<F>(5),
UnnamedField::new::<G>(6)];
let info = TupleInfo::new::<Self>(&fields);
TypeInfo::Tuple(info)
})
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> GetTypeRegistration for (A, B, C, D, E, F, G) {
fn get_type_registration() -> TypeRegistration {
TypeRegistration::of::<(A, B, C, D, E, F, G)>()
}
fn register_type_dependencies(_registry: &mut TypeRegistry) {
_registry.register::<A>();
_registry.register::<B>();
_registry.register::<C>();
_registry.register::<D>();
_registry.register::<E>();
_registry.register::<F>();
_registry.register::<G>();
}
}
impl<A: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
B: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
C: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
D: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
E: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
F: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
G: FromReflect + MaybeTyped + TypePath + GetTypeRegistration> FromReflect
for (A, B, C, D, E, F, G) {
fn from_reflect(reflect: &dyn PartialReflect) -> Option<Self> {
let _ref_tuple = reflect.reflect_ref().as_tuple().ok()?;
Some((<A as FromReflect>::from_reflect(_ref_tuple.field(0)?)?,
<B as FromReflect>::from_reflect(_ref_tuple.field(1)?)?,
<C as FromReflect>::from_reflect(_ref_tuple.field(2)?)?,
<D as FromReflect>::from_reflect(_ref_tuple.field(3)?)?,
<E as FromReflect>::from_reflect(_ref_tuple.field(4)?)?,
<F as FromReflect>::from_reflect(_ref_tuple.field(5)?)?,
<G as FromReflect>::from_reflect(_ref_tuple.field(6)?)?))
}
}impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G}
715
716impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Tuple for (A, B, C, D, E, F, G, H) {
#[inline]
fn field(&self, index: usize) -> Option<&dyn PartialReflect> {
match index {
0 => Some(&self.0 as &dyn PartialReflect),
1 => Some(&self.1 as &dyn PartialReflect),
2 => Some(&self.2 as &dyn PartialReflect),
3 => Some(&self.3 as &dyn PartialReflect),
4 => Some(&self.4 as &dyn PartialReflect),
5 => Some(&self.5 as &dyn PartialReflect),
6 => Some(&self.6 as &dyn PartialReflect),
7 => Some(&self.7 as &dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_mut(&mut self, index: usize) -> Option<&mut dyn PartialReflect> {
match index {
0 => Some(&mut self.0 as &mut dyn PartialReflect),
1 => Some(&mut self.1 as &mut dyn PartialReflect),
2 => Some(&mut self.2 as &mut dyn PartialReflect),
3 => Some(&mut self.3 as &mut dyn PartialReflect),
4 => Some(&mut self.4 as &mut dyn PartialReflect),
5 => Some(&mut self.5 as &mut dyn PartialReflect),
6 => Some(&mut self.6 as &mut dyn PartialReflect),
7 => Some(&mut self.7 as &mut dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_len(&self) -> usize {
let indices: &[usize] =
&[0 as usize, 1 as usize, 2 as usize, 3 as usize, 4 as usize,
5 as usize, 6 as usize, 7 as usize];
indices.len()
}
#[inline]
fn iter_fields(&self) -> TupleFieldIter<'_> {
TupleFieldIter { tuple: self, index: 0 }
}
#[inline]
fn drain(self: Box<Self>) -> Vec<Box<dyn PartialReflect>> {
::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
[Box::new(self.0), Box::new(self.1), Box::new(self.2),
Box::new(self.3), Box::new(self.4), Box::new(self.5),
Box::new(self.6), Box::new(self.7)]))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> PartialReflect for (A, B, C, D, E, F, G, H) {
fn get_represented_type_info(&self) -> Option<&'static TypeInfo> {
Some(<Self as Typed>::type_info())
}
#[inline]
fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect> {
self
}
fn as_partial_reflect(&self) -> &dyn PartialReflect { self }
fn as_partial_reflect_mut(&mut self) -> &mut dyn PartialReflect { self }
fn try_into_reflect(self: Box<Self>)
-> Result<Box<dyn Reflect>, Box<dyn PartialReflect>> {
Ok(self)
}
fn try_as_reflect(&self) -> Option<&dyn Reflect> { Some(self) }
fn try_as_reflect_mut(&mut self) -> Option<&mut dyn Reflect> {
Some(self)
}
fn reflect_kind(&self) -> ReflectKind { ReflectKind::Tuple }
fn reflect_ref(&self) -> ReflectRef<'_> { ReflectRef::Tuple(self) }
fn reflect_mut(&mut self) -> ReflectMut<'_> { ReflectMut::Tuple(self) }
fn reflect_owned(self: Box<Self>) -> ReflectOwned {
ReflectOwned::Tuple(self)
}
fn reflect_partial_eq(&self, value: &dyn PartialReflect) -> Option<bool> {
crate::tuple::tuple_partial_eq(self, value)
}
fn reflect_partial_cmp(&self, value: &dyn PartialReflect)
-> Option<::core::cmp::Ordering> {
crate::tuple::tuple_partial_cmp(self, value)
}
fn apply(&mut self, value: &dyn PartialReflect) {
crate::tuple::tuple_apply(self, value);
}
fn try_apply(&mut self, value: &dyn PartialReflect)
-> Result<(), ApplyError> {
crate::tuple::tuple_try_apply(self, value)
}
fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError> {
Ok(Box::new((self.0.reflect_clone()?.take::<A>().expect("`Reflect::reflect_clone` should return the same type"),
self.1.reflect_clone()?.take::<B>().expect("`Reflect::reflect_clone` should return the same type"),
self.2.reflect_clone()?.take::<C>().expect("`Reflect::reflect_clone` should return the same type"),
self.3.reflect_clone()?.take::<D>().expect("`Reflect::reflect_clone` should return the same type"),
self.4.reflect_clone()?.take::<E>().expect("`Reflect::reflect_clone` should return the same type"),
self.5.reflect_clone()?.take::<F>().expect("`Reflect::reflect_clone` should return the same type"),
self.6.reflect_clone()?.take::<G>().expect("`Reflect::reflect_clone` should return the same type"),
self.7.reflect_clone()?.take::<H>().expect("`Reflect::reflect_clone` should return the same type"))))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Reflect for (A, B, C, D, E, F, G, H) {
fn into_any(self: Box<Self>) -> Box<dyn Any> { self }
fn as_any(&self) -> &dyn Any { self }
fn as_any_mut(&mut self) -> &mut dyn Any { self }
fn into_reflect(self: Box<Self>) -> Box<dyn Reflect> { self }
fn as_reflect(&self) -> &dyn Reflect { self }
fn as_reflect_mut(&mut self) -> &mut dyn Reflect { self }
fn set(&mut self, value: Box<dyn Reflect>)
-> Result<(), Box<dyn Reflect>> {
*self = value.take()?;
Ok(())
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Typed for (A, B, C, D, E, F, G, H) {
fn type_info() -> &'static TypeInfo {
static CELL: crate::utility::GenericTypeInfoCell =
crate::utility::GenericTypeInfoCell::new();
CELL.get_or_insert::<Self,
_>(||
{
let fields =
[UnnamedField::new::<A>(0), UnnamedField::new::<B>(1),
UnnamedField::new::<C>(2), UnnamedField::new::<D>(3),
UnnamedField::new::<E>(4), UnnamedField::new::<F>(5),
UnnamedField::new::<G>(6), UnnamedField::new::<H>(7)];
let info = TupleInfo::new::<Self>(&fields);
TypeInfo::Tuple(info)
})
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> GetTypeRegistration for (A, B, C, D, E, F, G, H) {
fn get_type_registration() -> TypeRegistration {
TypeRegistration::of::<(A, B, C, D, E, F, G, H)>()
}
fn register_type_dependencies(_registry: &mut TypeRegistry) {
_registry.register::<A>();
_registry.register::<B>();
_registry.register::<C>();
_registry.register::<D>();
_registry.register::<E>();
_registry.register::<F>();
_registry.register::<G>();
_registry.register::<H>();
}
}
impl<A: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
B: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
C: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
D: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
E: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
F: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
G: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
H: FromReflect + MaybeTyped + TypePath + GetTypeRegistration> FromReflect
for (A, B, C, D, E, F, G, H) {
fn from_reflect(reflect: &dyn PartialReflect) -> Option<Self> {
let _ref_tuple = reflect.reflect_ref().as_tuple().ok()?;
Some((<A as FromReflect>::from_reflect(_ref_tuple.field(0)?)?,
<B as FromReflect>::from_reflect(_ref_tuple.field(1)?)?,
<C as FromReflect>::from_reflect(_ref_tuple.field(2)?)?,
<D as FromReflect>::from_reflect(_ref_tuple.field(3)?)?,
<E as FromReflect>::from_reflect(_ref_tuple.field(4)?)?,
<F as FromReflect>::from_reflect(_ref_tuple.field(5)?)?,
<G as FromReflect>::from_reflect(_ref_tuple.field(6)?)?,
<H as FromReflect>::from_reflect(_ref_tuple.field(7)?)?))
}
}impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G, 7: H}
717
718impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, I: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Tuple for (A, B, C, D, E, F, G, H, I) {
#[inline]
fn field(&self, index: usize) -> Option<&dyn PartialReflect> {
match index {
0 => Some(&self.0 as &dyn PartialReflect),
1 => Some(&self.1 as &dyn PartialReflect),
2 => Some(&self.2 as &dyn PartialReflect),
3 => Some(&self.3 as &dyn PartialReflect),
4 => Some(&self.4 as &dyn PartialReflect),
5 => Some(&self.5 as &dyn PartialReflect),
6 => Some(&self.6 as &dyn PartialReflect),
7 => Some(&self.7 as &dyn PartialReflect),
8 => Some(&self.8 as &dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_mut(&mut self, index: usize) -> Option<&mut dyn PartialReflect> {
match index {
0 => Some(&mut self.0 as &mut dyn PartialReflect),
1 => Some(&mut self.1 as &mut dyn PartialReflect),
2 => Some(&mut self.2 as &mut dyn PartialReflect),
3 => Some(&mut self.3 as &mut dyn PartialReflect),
4 => Some(&mut self.4 as &mut dyn PartialReflect),
5 => Some(&mut self.5 as &mut dyn PartialReflect),
6 => Some(&mut self.6 as &mut dyn PartialReflect),
7 => Some(&mut self.7 as &mut dyn PartialReflect),
8 => Some(&mut self.8 as &mut dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_len(&self) -> usize {
let indices: &[usize] =
&[0 as usize, 1 as usize, 2 as usize, 3 as usize, 4 as usize,
5 as usize, 6 as usize, 7 as usize, 8 as usize];
indices.len()
}
#[inline]
fn iter_fields(&self) -> TupleFieldIter<'_> {
TupleFieldIter { tuple: self, index: 0 }
}
#[inline]
fn drain(self: Box<Self>) -> Vec<Box<dyn PartialReflect>> {
::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
[Box::new(self.0), Box::new(self.1), Box::new(self.2),
Box::new(self.3), Box::new(self.4), Box::new(self.5),
Box::new(self.6), Box::new(self.7), Box::new(self.8)]))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, I: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> PartialReflect for (A, B, C, D, E, F, G, H, I) {
fn get_represented_type_info(&self) -> Option<&'static TypeInfo> {
Some(<Self as Typed>::type_info())
}
#[inline]
fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect> {
self
}
fn as_partial_reflect(&self) -> &dyn PartialReflect { self }
fn as_partial_reflect_mut(&mut self) -> &mut dyn PartialReflect { self }
fn try_into_reflect(self: Box<Self>)
-> Result<Box<dyn Reflect>, Box<dyn PartialReflect>> {
Ok(self)
}
fn try_as_reflect(&self) -> Option<&dyn Reflect> { Some(self) }
fn try_as_reflect_mut(&mut self) -> Option<&mut dyn Reflect> {
Some(self)
}
fn reflect_kind(&self) -> ReflectKind { ReflectKind::Tuple }
fn reflect_ref(&self) -> ReflectRef<'_> { ReflectRef::Tuple(self) }
fn reflect_mut(&mut self) -> ReflectMut<'_> { ReflectMut::Tuple(self) }
fn reflect_owned(self: Box<Self>) -> ReflectOwned {
ReflectOwned::Tuple(self)
}
fn reflect_partial_eq(&self, value: &dyn PartialReflect) -> Option<bool> {
crate::tuple::tuple_partial_eq(self, value)
}
fn reflect_partial_cmp(&self, value: &dyn PartialReflect)
-> Option<::core::cmp::Ordering> {
crate::tuple::tuple_partial_cmp(self, value)
}
fn apply(&mut self, value: &dyn PartialReflect) {
crate::tuple::tuple_apply(self, value);
}
fn try_apply(&mut self, value: &dyn PartialReflect)
-> Result<(), ApplyError> {
crate::tuple::tuple_try_apply(self, value)
}
fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError> {
Ok(Box::new((self.0.reflect_clone()?.take::<A>().expect("`Reflect::reflect_clone` should return the same type"),
self.1.reflect_clone()?.take::<B>().expect("`Reflect::reflect_clone` should return the same type"),
self.2.reflect_clone()?.take::<C>().expect("`Reflect::reflect_clone` should return the same type"),
self.3.reflect_clone()?.take::<D>().expect("`Reflect::reflect_clone` should return the same type"),
self.4.reflect_clone()?.take::<E>().expect("`Reflect::reflect_clone` should return the same type"),
self.5.reflect_clone()?.take::<F>().expect("`Reflect::reflect_clone` should return the same type"),
self.6.reflect_clone()?.take::<G>().expect("`Reflect::reflect_clone` should return the same type"),
self.7.reflect_clone()?.take::<H>().expect("`Reflect::reflect_clone` should return the same type"),
self.8.reflect_clone()?.take::<I>().expect("`Reflect::reflect_clone` should return the same type"))))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, I: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Reflect for (A, B, C, D, E, F, G, H, I) {
fn into_any(self: Box<Self>) -> Box<dyn Any> { self }
fn as_any(&self) -> &dyn Any { self }
fn as_any_mut(&mut self) -> &mut dyn Any { self }
fn into_reflect(self: Box<Self>) -> Box<dyn Reflect> { self }
fn as_reflect(&self) -> &dyn Reflect { self }
fn as_reflect_mut(&mut self) -> &mut dyn Reflect { self }
fn set(&mut self, value: Box<dyn Reflect>)
-> Result<(), Box<dyn Reflect>> {
*self = value.take()?;
Ok(())
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, I: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Typed for (A, B, C, D, E, F, G, H, I) {
fn type_info() -> &'static TypeInfo {
static CELL: crate::utility::GenericTypeInfoCell =
crate::utility::GenericTypeInfoCell::new();
CELL.get_or_insert::<Self,
_>(||
{
let fields =
[UnnamedField::new::<A>(0), UnnamedField::new::<B>(1),
UnnamedField::new::<C>(2), UnnamedField::new::<D>(3),
UnnamedField::new::<E>(4), UnnamedField::new::<F>(5),
UnnamedField::new::<G>(6), UnnamedField::new::<H>(7),
UnnamedField::new::<I>(8)];
let info = TupleInfo::new::<Self>(&fields);
TypeInfo::Tuple(info)
})
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, I: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> GetTypeRegistration for (A, B, C, D, E, F, G, H, I) {
fn get_type_registration() -> TypeRegistration {
TypeRegistration::of::<(A, B, C, D, E, F, G, H, I)>()
}
fn register_type_dependencies(_registry: &mut TypeRegistry) {
_registry.register::<A>();
_registry.register::<B>();
_registry.register::<C>();
_registry.register::<D>();
_registry.register::<E>();
_registry.register::<F>();
_registry.register::<G>();
_registry.register::<H>();
_registry.register::<I>();
}
}
impl<A: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
B: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
C: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
D: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
E: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
F: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
G: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
H: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
I: FromReflect + MaybeTyped + TypePath + GetTypeRegistration> FromReflect
for (A, B, C, D, E, F, G, H, I) {
fn from_reflect(reflect: &dyn PartialReflect) -> Option<Self> {
let _ref_tuple = reflect.reflect_ref().as_tuple().ok()?;
Some((<A as FromReflect>::from_reflect(_ref_tuple.field(0)?)?,
<B as FromReflect>::from_reflect(_ref_tuple.field(1)?)?,
<C as FromReflect>::from_reflect(_ref_tuple.field(2)?)?,
<D as FromReflect>::from_reflect(_ref_tuple.field(3)?)?,
<E as FromReflect>::from_reflect(_ref_tuple.field(4)?)?,
<F as FromReflect>::from_reflect(_ref_tuple.field(5)?)?,
<G as FromReflect>::from_reflect(_ref_tuple.field(6)?)?,
<H as FromReflect>::from_reflect(_ref_tuple.field(7)?)?,
<I as FromReflect>::from_reflect(_ref_tuple.field(8)?)?))
}
}impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G, 7: H, 8: I}
719
720impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, I: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, J: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Tuple for (A, B, C, D, E, F, G, H, I, J) {
#[inline]
fn field(&self, index: usize) -> Option<&dyn PartialReflect> {
match index {
0 => Some(&self.0 as &dyn PartialReflect),
1 => Some(&self.1 as &dyn PartialReflect),
2 => Some(&self.2 as &dyn PartialReflect),
3 => Some(&self.3 as &dyn PartialReflect),
4 => Some(&self.4 as &dyn PartialReflect),
5 => Some(&self.5 as &dyn PartialReflect),
6 => Some(&self.6 as &dyn PartialReflect),
7 => Some(&self.7 as &dyn PartialReflect),
8 => Some(&self.8 as &dyn PartialReflect),
9 => Some(&self.9 as &dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_mut(&mut self, index: usize) -> Option<&mut dyn PartialReflect> {
match index {
0 => Some(&mut self.0 as &mut dyn PartialReflect),
1 => Some(&mut self.1 as &mut dyn PartialReflect),
2 => Some(&mut self.2 as &mut dyn PartialReflect),
3 => Some(&mut self.3 as &mut dyn PartialReflect),
4 => Some(&mut self.4 as &mut dyn PartialReflect),
5 => Some(&mut self.5 as &mut dyn PartialReflect),
6 => Some(&mut self.6 as &mut dyn PartialReflect),
7 => Some(&mut self.7 as &mut dyn PartialReflect),
8 => Some(&mut self.8 as &mut dyn PartialReflect),
9 => Some(&mut self.9 as &mut dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_len(&self) -> usize {
let indices: &[usize] =
&[0 as usize, 1 as usize, 2 as usize, 3 as usize, 4 as usize,
5 as usize, 6 as usize, 7 as usize, 8 as usize, 9 as usize];
indices.len()
}
#[inline]
fn iter_fields(&self) -> TupleFieldIter<'_> {
TupleFieldIter { tuple: self, index: 0 }
}
#[inline]
fn drain(self: Box<Self>) -> Vec<Box<dyn PartialReflect>> {
::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
[Box::new(self.0), Box::new(self.1), Box::new(self.2),
Box::new(self.3), Box::new(self.4), Box::new(self.5),
Box::new(self.6), Box::new(self.7), Box::new(self.8),
Box::new(self.9)]))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, I: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, J: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> PartialReflect for (A, B, C, D, E, F, G, H, I, J) {
fn get_represented_type_info(&self) -> Option<&'static TypeInfo> {
Some(<Self as Typed>::type_info())
}
#[inline]
fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect> {
self
}
fn as_partial_reflect(&self) -> &dyn PartialReflect { self }
fn as_partial_reflect_mut(&mut self) -> &mut dyn PartialReflect { self }
fn try_into_reflect(self: Box<Self>)
-> Result<Box<dyn Reflect>, Box<dyn PartialReflect>> {
Ok(self)
}
fn try_as_reflect(&self) -> Option<&dyn Reflect> { Some(self) }
fn try_as_reflect_mut(&mut self) -> Option<&mut dyn Reflect> {
Some(self)
}
fn reflect_kind(&self) -> ReflectKind { ReflectKind::Tuple }
fn reflect_ref(&self) -> ReflectRef<'_> { ReflectRef::Tuple(self) }
fn reflect_mut(&mut self) -> ReflectMut<'_> { ReflectMut::Tuple(self) }
fn reflect_owned(self: Box<Self>) -> ReflectOwned {
ReflectOwned::Tuple(self)
}
fn reflect_partial_eq(&self, value: &dyn PartialReflect) -> Option<bool> {
crate::tuple::tuple_partial_eq(self, value)
}
fn reflect_partial_cmp(&self, value: &dyn PartialReflect)
-> Option<::core::cmp::Ordering> {
crate::tuple::tuple_partial_cmp(self, value)
}
fn apply(&mut self, value: &dyn PartialReflect) {
crate::tuple::tuple_apply(self, value);
}
fn try_apply(&mut self, value: &dyn PartialReflect)
-> Result<(), ApplyError> {
crate::tuple::tuple_try_apply(self, value)
}
fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError> {
Ok(Box::new((self.0.reflect_clone()?.take::<A>().expect("`Reflect::reflect_clone` should return the same type"),
self.1.reflect_clone()?.take::<B>().expect("`Reflect::reflect_clone` should return the same type"),
self.2.reflect_clone()?.take::<C>().expect("`Reflect::reflect_clone` should return the same type"),
self.3.reflect_clone()?.take::<D>().expect("`Reflect::reflect_clone` should return the same type"),
self.4.reflect_clone()?.take::<E>().expect("`Reflect::reflect_clone` should return the same type"),
self.5.reflect_clone()?.take::<F>().expect("`Reflect::reflect_clone` should return the same type"),
self.6.reflect_clone()?.take::<G>().expect("`Reflect::reflect_clone` should return the same type"),
self.7.reflect_clone()?.take::<H>().expect("`Reflect::reflect_clone` should return the same type"),
self.8.reflect_clone()?.take::<I>().expect("`Reflect::reflect_clone` should return the same type"),
self.9.reflect_clone()?.take::<J>().expect("`Reflect::reflect_clone` should return the same type"))))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, I: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, J: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Reflect for (A, B, C, D, E, F, G, H, I, J) {
fn into_any(self: Box<Self>) -> Box<dyn Any> { self }
fn as_any(&self) -> &dyn Any { self }
fn as_any_mut(&mut self) -> &mut dyn Any { self }
fn into_reflect(self: Box<Self>) -> Box<dyn Reflect> { self }
fn as_reflect(&self) -> &dyn Reflect { self }
fn as_reflect_mut(&mut self) -> &mut dyn Reflect { self }
fn set(&mut self, value: Box<dyn Reflect>)
-> Result<(), Box<dyn Reflect>> {
*self = value.take()?;
Ok(())
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, I: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, J: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Typed for (A, B, C, D, E, F, G, H, I, J) {
fn type_info() -> &'static TypeInfo {
static CELL: crate::utility::GenericTypeInfoCell =
crate::utility::GenericTypeInfoCell::new();
CELL.get_or_insert::<Self,
_>(||
{
let fields =
[UnnamedField::new::<A>(0), UnnamedField::new::<B>(1),
UnnamedField::new::<C>(2), UnnamedField::new::<D>(3),
UnnamedField::new::<E>(4), UnnamedField::new::<F>(5),
UnnamedField::new::<G>(6), UnnamedField::new::<H>(7),
UnnamedField::new::<I>(8), UnnamedField::new::<J>(9)];
let info = TupleInfo::new::<Self>(&fields);
TypeInfo::Tuple(info)
})
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, I: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, J: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> GetTypeRegistration for
(A, B, C, D, E, F, G, H, I, J) {
fn get_type_registration() -> TypeRegistration {
TypeRegistration::of::<(A, B, C, D, E, F, G, H, I, J)>()
}
fn register_type_dependencies(_registry: &mut TypeRegistry) {
_registry.register::<A>();
_registry.register::<B>();
_registry.register::<C>();
_registry.register::<D>();
_registry.register::<E>();
_registry.register::<F>();
_registry.register::<G>();
_registry.register::<H>();
_registry.register::<I>();
_registry.register::<J>();
}
}
impl<A: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
B: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
C: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
D: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
E: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
F: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
G: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
H: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
I: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
J: FromReflect + MaybeTyped + TypePath + GetTypeRegistration> FromReflect
for (A, B, C, D, E, F, G, H, I, J) {
fn from_reflect(reflect: &dyn PartialReflect) -> Option<Self> {
let _ref_tuple = reflect.reflect_ref().as_tuple().ok()?;
Some((<A as FromReflect>::from_reflect(_ref_tuple.field(0)?)?,
<B as FromReflect>::from_reflect(_ref_tuple.field(1)?)?,
<C as FromReflect>::from_reflect(_ref_tuple.field(2)?)?,
<D as FromReflect>::from_reflect(_ref_tuple.field(3)?)?,
<E as FromReflect>::from_reflect(_ref_tuple.field(4)?)?,
<F as FromReflect>::from_reflect(_ref_tuple.field(5)?)?,
<G as FromReflect>::from_reflect(_ref_tuple.field(6)?)?,
<H as FromReflect>::from_reflect(_ref_tuple.field(7)?)?,
<I as FromReflect>::from_reflect(_ref_tuple.field(8)?)?,
<J as FromReflect>::from_reflect(_ref_tuple.field(9)?)?))
}
}impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G, 7: H, 8: I, 9: J}
721
722impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, I: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, J: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, K: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Tuple for (A, B, C, D, E, F, G, H, I, J, K) {
#[inline]
fn field(&self, index: usize) -> Option<&dyn PartialReflect> {
match index {
0 => Some(&self.0 as &dyn PartialReflect),
1 => Some(&self.1 as &dyn PartialReflect),
2 => Some(&self.2 as &dyn PartialReflect),
3 => Some(&self.3 as &dyn PartialReflect),
4 => Some(&self.4 as &dyn PartialReflect),
5 => Some(&self.5 as &dyn PartialReflect),
6 => Some(&self.6 as &dyn PartialReflect),
7 => Some(&self.7 as &dyn PartialReflect),
8 => Some(&self.8 as &dyn PartialReflect),
9 => Some(&self.9 as &dyn PartialReflect),
10 => Some(&self.10 as &dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_mut(&mut self, index: usize) -> Option<&mut dyn PartialReflect> {
match index {
0 => Some(&mut self.0 as &mut dyn PartialReflect),
1 => Some(&mut self.1 as &mut dyn PartialReflect),
2 => Some(&mut self.2 as &mut dyn PartialReflect),
3 => Some(&mut self.3 as &mut dyn PartialReflect),
4 => Some(&mut self.4 as &mut dyn PartialReflect),
5 => Some(&mut self.5 as &mut dyn PartialReflect),
6 => Some(&mut self.6 as &mut dyn PartialReflect),
7 => Some(&mut self.7 as &mut dyn PartialReflect),
8 => Some(&mut self.8 as &mut dyn PartialReflect),
9 => Some(&mut self.9 as &mut dyn PartialReflect),
10 => Some(&mut self.10 as &mut dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_len(&self) -> usize {
let indices: &[usize] =
&[0 as usize, 1 as usize, 2 as usize, 3 as usize, 4 as usize,
5 as usize, 6 as usize, 7 as usize, 8 as usize, 9 as usize,
10 as usize];
indices.len()
}
#[inline]
fn iter_fields(&self) -> TupleFieldIter<'_> {
TupleFieldIter { tuple: self, index: 0 }
}
#[inline]
fn drain(self: Box<Self>) -> Vec<Box<dyn PartialReflect>> {
::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
[Box::new(self.0), Box::new(self.1), Box::new(self.2),
Box::new(self.3), Box::new(self.4), Box::new(self.5),
Box::new(self.6), Box::new(self.7), Box::new(self.8),
Box::new(self.9), Box::new(self.10)]))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, I: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, J: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, K: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> PartialReflect for (A, B, C, D, E, F, G, H, I, J, K)
{
fn get_represented_type_info(&self) -> Option<&'static TypeInfo> {
Some(<Self as Typed>::type_info())
}
#[inline]
fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect> {
self
}
fn as_partial_reflect(&self) -> &dyn PartialReflect { self }
fn as_partial_reflect_mut(&mut self) -> &mut dyn PartialReflect { self }
fn try_into_reflect(self: Box<Self>)
-> Result<Box<dyn Reflect>, Box<dyn PartialReflect>> {
Ok(self)
}
fn try_as_reflect(&self) -> Option<&dyn Reflect> { Some(self) }
fn try_as_reflect_mut(&mut self) -> Option<&mut dyn Reflect> {
Some(self)
}
fn reflect_kind(&self) -> ReflectKind { ReflectKind::Tuple }
fn reflect_ref(&self) -> ReflectRef<'_> { ReflectRef::Tuple(self) }
fn reflect_mut(&mut self) -> ReflectMut<'_> { ReflectMut::Tuple(self) }
fn reflect_owned(self: Box<Self>) -> ReflectOwned {
ReflectOwned::Tuple(self)
}
fn reflect_partial_eq(&self, value: &dyn PartialReflect) -> Option<bool> {
crate::tuple::tuple_partial_eq(self, value)
}
fn reflect_partial_cmp(&self, value: &dyn PartialReflect)
-> Option<::core::cmp::Ordering> {
crate::tuple::tuple_partial_cmp(self, value)
}
fn apply(&mut self, value: &dyn PartialReflect) {
crate::tuple::tuple_apply(self, value);
}
fn try_apply(&mut self, value: &dyn PartialReflect)
-> Result<(), ApplyError> {
crate::tuple::tuple_try_apply(self, value)
}
fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError> {
Ok(Box::new((self.0.reflect_clone()?.take::<A>().expect("`Reflect::reflect_clone` should return the same type"),
self.1.reflect_clone()?.take::<B>().expect("`Reflect::reflect_clone` should return the same type"),
self.2.reflect_clone()?.take::<C>().expect("`Reflect::reflect_clone` should return the same type"),
self.3.reflect_clone()?.take::<D>().expect("`Reflect::reflect_clone` should return the same type"),
self.4.reflect_clone()?.take::<E>().expect("`Reflect::reflect_clone` should return the same type"),
self.5.reflect_clone()?.take::<F>().expect("`Reflect::reflect_clone` should return the same type"),
self.6.reflect_clone()?.take::<G>().expect("`Reflect::reflect_clone` should return the same type"),
self.7.reflect_clone()?.take::<H>().expect("`Reflect::reflect_clone` should return the same type"),
self.8.reflect_clone()?.take::<I>().expect("`Reflect::reflect_clone` should return the same type"),
self.9.reflect_clone()?.take::<J>().expect("`Reflect::reflect_clone` should return the same type"),
self.10.reflect_clone()?.take::<K>().expect("`Reflect::reflect_clone` should return the same type"))))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, I: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, J: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, K: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Reflect for (A, B, C, D, E, F, G, H, I, J, K) {
fn into_any(self: Box<Self>) -> Box<dyn Any> { self }
fn as_any(&self) -> &dyn Any { self }
fn as_any_mut(&mut self) -> &mut dyn Any { self }
fn into_reflect(self: Box<Self>) -> Box<dyn Reflect> { self }
fn as_reflect(&self) -> &dyn Reflect { self }
fn as_reflect_mut(&mut self) -> &mut dyn Reflect { self }
fn set(&mut self, value: Box<dyn Reflect>)
-> Result<(), Box<dyn Reflect>> {
*self = value.take()?;
Ok(())
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, I: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, J: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, K: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Typed for (A, B, C, D, E, F, G, H, I, J, K) {
fn type_info() -> &'static TypeInfo {
static CELL: crate::utility::GenericTypeInfoCell =
crate::utility::GenericTypeInfoCell::new();
CELL.get_or_insert::<Self,
_>(||
{
let fields =
[UnnamedField::new::<A>(0), UnnamedField::new::<B>(1),
UnnamedField::new::<C>(2), UnnamedField::new::<D>(3),
UnnamedField::new::<E>(4), UnnamedField::new::<F>(5),
UnnamedField::new::<G>(6), UnnamedField::new::<H>(7),
UnnamedField::new::<I>(8), UnnamedField::new::<J>(9),
UnnamedField::new::<K>(10)];
let info = TupleInfo::new::<Self>(&fields);
TypeInfo::Tuple(info)
})
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, I: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, J: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, K: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> GetTypeRegistration for
(A, B, C, D, E, F, G, H, I, J, K) {
fn get_type_registration() -> TypeRegistration {
TypeRegistration::of::<(A, B, C, D, E, F, G, H, I, J, K)>()
}
fn register_type_dependencies(_registry: &mut TypeRegistry) {
_registry.register::<A>();
_registry.register::<B>();
_registry.register::<C>();
_registry.register::<D>();
_registry.register::<E>();
_registry.register::<F>();
_registry.register::<G>();
_registry.register::<H>();
_registry.register::<I>();
_registry.register::<J>();
_registry.register::<K>();
}
}
impl<A: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
B: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
C: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
D: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
E: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
F: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
G: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
H: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
I: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
J: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
K: FromReflect + MaybeTyped + TypePath + GetTypeRegistration> FromReflect
for (A, B, C, D, E, F, G, H, I, J, K) {
fn from_reflect(reflect: &dyn PartialReflect) -> Option<Self> {
let _ref_tuple = reflect.reflect_ref().as_tuple().ok()?;
Some((<A as FromReflect>::from_reflect(_ref_tuple.field(0)?)?,
<B as FromReflect>::from_reflect(_ref_tuple.field(1)?)?,
<C as FromReflect>::from_reflect(_ref_tuple.field(2)?)?,
<D as FromReflect>::from_reflect(_ref_tuple.field(3)?)?,
<E as FromReflect>::from_reflect(_ref_tuple.field(4)?)?,
<F as FromReflect>::from_reflect(_ref_tuple.field(5)?)?,
<G as FromReflect>::from_reflect(_ref_tuple.field(6)?)?,
<H as FromReflect>::from_reflect(_ref_tuple.field(7)?)?,
<I as FromReflect>::from_reflect(_ref_tuple.field(8)?)?,
<J as FromReflect>::from_reflect(_ref_tuple.field(9)?)?,
<K as FromReflect>::from_reflect(_ref_tuple.field(10)?)?))
}
}impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G, 7: H, 8: I, 9: J, 10: K}
723
724impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, I: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, J: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, K: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, L: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Tuple for (A, B, C, D, E, F, G, H, I, J, K, L) {
#[inline]
fn field(&self, index: usize) -> Option<&dyn PartialReflect> {
match index {
0 => Some(&self.0 as &dyn PartialReflect),
1 => Some(&self.1 as &dyn PartialReflect),
2 => Some(&self.2 as &dyn PartialReflect),
3 => Some(&self.3 as &dyn PartialReflect),
4 => Some(&self.4 as &dyn PartialReflect),
5 => Some(&self.5 as &dyn PartialReflect),
6 => Some(&self.6 as &dyn PartialReflect),
7 => Some(&self.7 as &dyn PartialReflect),
8 => Some(&self.8 as &dyn PartialReflect),
9 => Some(&self.9 as &dyn PartialReflect),
10 => Some(&self.10 as &dyn PartialReflect),
11 => Some(&self.11 as &dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_mut(&mut self, index: usize) -> Option<&mut dyn PartialReflect> {
match index {
0 => Some(&mut self.0 as &mut dyn PartialReflect),
1 => Some(&mut self.1 as &mut dyn PartialReflect),
2 => Some(&mut self.2 as &mut dyn PartialReflect),
3 => Some(&mut self.3 as &mut dyn PartialReflect),
4 => Some(&mut self.4 as &mut dyn PartialReflect),
5 => Some(&mut self.5 as &mut dyn PartialReflect),
6 => Some(&mut self.6 as &mut dyn PartialReflect),
7 => Some(&mut self.7 as &mut dyn PartialReflect),
8 => Some(&mut self.8 as &mut dyn PartialReflect),
9 => Some(&mut self.9 as &mut dyn PartialReflect),
10 => Some(&mut self.10 as &mut dyn PartialReflect),
11 => Some(&mut self.11 as &mut dyn PartialReflect),
_ => None,
}
}
#[inline]
fn field_len(&self) -> usize {
let indices: &[usize] =
&[0 as usize, 1 as usize, 2 as usize, 3 as usize, 4 as usize,
5 as usize, 6 as usize, 7 as usize, 8 as usize, 9 as usize,
10 as usize, 11 as usize];
indices.len()
}
#[inline]
fn iter_fields(&self) -> TupleFieldIter<'_> {
TupleFieldIter { tuple: self, index: 0 }
}
#[inline]
fn drain(self: Box<Self>) -> Vec<Box<dyn PartialReflect>> {
::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
[Box::new(self.0), Box::new(self.1), Box::new(self.2),
Box::new(self.3), Box::new(self.4), Box::new(self.5),
Box::new(self.6), Box::new(self.7), Box::new(self.8),
Box::new(self.9), Box::new(self.10), Box::new(self.11)]))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, I: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, J: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, K: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, L: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> PartialReflect for
(A, B, C, D, E, F, G, H, I, J, K, L) {
fn get_represented_type_info(&self) -> Option<&'static TypeInfo> {
Some(<Self as Typed>::type_info())
}
#[inline]
fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect> {
self
}
fn as_partial_reflect(&self) -> &dyn PartialReflect { self }
fn as_partial_reflect_mut(&mut self) -> &mut dyn PartialReflect { self }
fn try_into_reflect(self: Box<Self>)
-> Result<Box<dyn Reflect>, Box<dyn PartialReflect>> {
Ok(self)
}
fn try_as_reflect(&self) -> Option<&dyn Reflect> { Some(self) }
fn try_as_reflect_mut(&mut self) -> Option<&mut dyn Reflect> {
Some(self)
}
fn reflect_kind(&self) -> ReflectKind { ReflectKind::Tuple }
fn reflect_ref(&self) -> ReflectRef<'_> { ReflectRef::Tuple(self) }
fn reflect_mut(&mut self) -> ReflectMut<'_> { ReflectMut::Tuple(self) }
fn reflect_owned(self: Box<Self>) -> ReflectOwned {
ReflectOwned::Tuple(self)
}
fn reflect_partial_eq(&self, value: &dyn PartialReflect) -> Option<bool> {
crate::tuple::tuple_partial_eq(self, value)
}
fn reflect_partial_cmp(&self, value: &dyn PartialReflect)
-> Option<::core::cmp::Ordering> {
crate::tuple::tuple_partial_cmp(self, value)
}
fn apply(&mut self, value: &dyn PartialReflect) {
crate::tuple::tuple_apply(self, value);
}
fn try_apply(&mut self, value: &dyn PartialReflect)
-> Result<(), ApplyError> {
crate::tuple::tuple_try_apply(self, value)
}
fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError> {
Ok(Box::new((self.0.reflect_clone()?.take::<A>().expect("`Reflect::reflect_clone` should return the same type"),
self.1.reflect_clone()?.take::<B>().expect("`Reflect::reflect_clone` should return the same type"),
self.2.reflect_clone()?.take::<C>().expect("`Reflect::reflect_clone` should return the same type"),
self.3.reflect_clone()?.take::<D>().expect("`Reflect::reflect_clone` should return the same type"),
self.4.reflect_clone()?.take::<E>().expect("`Reflect::reflect_clone` should return the same type"),
self.5.reflect_clone()?.take::<F>().expect("`Reflect::reflect_clone` should return the same type"),
self.6.reflect_clone()?.take::<G>().expect("`Reflect::reflect_clone` should return the same type"),
self.7.reflect_clone()?.take::<H>().expect("`Reflect::reflect_clone` should return the same type"),
self.8.reflect_clone()?.take::<I>().expect("`Reflect::reflect_clone` should return the same type"),
self.9.reflect_clone()?.take::<J>().expect("`Reflect::reflect_clone` should return the same type"),
self.10.reflect_clone()?.take::<K>().expect("`Reflect::reflect_clone` should return the same type"),
self.11.reflect_clone()?.take::<L>().expect("`Reflect::reflect_clone` should return the same type"))))
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, I: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, J: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, K: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, L: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Reflect for (A, B, C, D, E, F, G, H, I, J, K, L) {
fn into_any(self: Box<Self>) -> Box<dyn Any> { self }
fn as_any(&self) -> &dyn Any { self }
fn as_any_mut(&mut self) -> &mut dyn Any { self }
fn into_reflect(self: Box<Self>) -> Box<dyn Reflect> { self }
fn as_reflect(&self) -> &dyn Reflect { self }
fn as_reflect_mut(&mut self) -> &mut dyn Reflect { self }
fn set(&mut self, value: Box<dyn Reflect>)
-> Result<(), Box<dyn Reflect>> {
*self = value.take()?;
Ok(())
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, I: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, J: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, K: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, L: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> Typed for (A, B, C, D, E, F, G, H, I, J, K, L) {
fn type_info() -> &'static TypeInfo {
static CELL: crate::utility::GenericTypeInfoCell =
crate::utility::GenericTypeInfoCell::new();
CELL.get_or_insert::<Self,
_>(||
{
let fields =
[UnnamedField::new::<A>(0), UnnamedField::new::<B>(1),
UnnamedField::new::<C>(2), UnnamedField::new::<D>(3),
UnnamedField::new::<E>(4), UnnamedField::new::<F>(5),
UnnamedField::new::<G>(6), UnnamedField::new::<H>(7),
UnnamedField::new::<I>(8), UnnamedField::new::<J>(9),
UnnamedField::new::<K>(10), UnnamedField::new::<L>(11)];
let info = TupleInfo::new::<Self>(&fields);
TypeInfo::Tuple(info)
})
}
}
impl<A: Reflect + MaybeTyped + TypePath + GetTypeRegistration, B: Reflect +
MaybeTyped + TypePath + GetTypeRegistration, C: Reflect + MaybeTyped +
TypePath + GetTypeRegistration, D: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, E: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, F: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, G: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, H: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, I: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, J: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, K: Reflect + MaybeTyped + TypePath +
GetTypeRegistration, L: Reflect + MaybeTyped + TypePath +
GetTypeRegistration> GetTypeRegistration for
(A, B, C, D, E, F, G, H, I, J, K, L) {
fn get_type_registration() -> TypeRegistration {
TypeRegistration::of::<(A, B, C, D, E, F, G, H, I, J, K, L)>()
}
fn register_type_dependencies(_registry: &mut TypeRegistry) {
_registry.register::<A>();
_registry.register::<B>();
_registry.register::<C>();
_registry.register::<D>();
_registry.register::<E>();
_registry.register::<F>();
_registry.register::<G>();
_registry.register::<H>();
_registry.register::<I>();
_registry.register::<J>();
_registry.register::<K>();
_registry.register::<L>();
}
}
impl<A: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
B: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
C: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
D: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
E: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
F: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
G: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
H: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
I: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
J: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
K: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
L: FromReflect + MaybeTyped + TypePath + GetTypeRegistration> FromReflect
for (A, B, C, D, E, F, G, H, I, J, K, L) {
fn from_reflect(reflect: &dyn PartialReflect) -> Option<Self> {
let _ref_tuple = reflect.reflect_ref().as_tuple().ok()?;
Some((<A as FromReflect>::from_reflect(_ref_tuple.field(0)?)?,
<B as FromReflect>::from_reflect(_ref_tuple.field(1)?)?,
<C as FromReflect>::from_reflect(_ref_tuple.field(2)?)?,
<D as FromReflect>::from_reflect(_ref_tuple.field(3)?)?,
<E as FromReflect>::from_reflect(_ref_tuple.field(4)?)?,
<F as FromReflect>::from_reflect(_ref_tuple.field(5)?)?,
<G as FromReflect>::from_reflect(_ref_tuple.field(6)?)?,
<H as FromReflect>::from_reflect(_ref_tuple.field(7)?)?,
<I as FromReflect>::from_reflect(_ref_tuple.field(8)?)?,
<J as FromReflect>::from_reflect(_ref_tuple.field(9)?)?,
<K as FromReflect>::from_reflect(_ref_tuple.field(10)?)?,
<L as FromReflect>::from_reflect(_ref_tuple.field(11)?)?))
}
}impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G, 7: H, 8: I, 9: J, 10: K, 11: L}
725
726macro_rules! impl_type_path_tuple {
727 ($(#[$meta:meta])*) => {
728 $(#[$meta])*
729 impl TypePath for () {
730 fn type_path() -> &'static str {
731 "()"
732 }
733
734 fn short_type_path() -> &'static str {
735 "()"
736 }
737 }
738 };
739
740 ($(#[$meta:meta])* $param:ident) => {
741 $(#[$meta])*
742 impl <$param: TypePath> TypePath for ($param,) {
743 fn type_path() -> &'static str {
744 use $crate::__macro_exports::alloc_utils::ToOwned;
745 static CELL: GenericTypePathCell = GenericTypePathCell::new();
746 CELL.get_or_insert::<Self, _>(|| {
747 "(".to_owned() + $param::type_path() + ",)"
748 })
749 }
750
751 fn short_type_path() -> &'static str {
752 use $crate::__macro_exports::alloc_utils::ToOwned;
753 static CELL: GenericTypePathCell = GenericTypePathCell::new();
754 CELL.get_or_insert::<Self, _>(|| {
755 "(".to_owned() + $param::short_type_path() + ",)"
756 })
757 }
758 }
759 };
760
761 ($(#[$meta:meta])* $last:ident $(,$param:ident)*) => {
762 $(#[$meta])*
763 impl <$($param: TypePath,)* $last: TypePath> TypePath for ($($param,)* $last) {
764 fn type_path() -> &'static str {
765 use $crate::__macro_exports::alloc_utils::ToOwned;
766 static CELL: GenericTypePathCell = GenericTypePathCell::new();
767 CELL.get_or_insert::<Self, _>(|| {
768 "(".to_owned() $(+ $param::type_path() + ", ")* + $last::type_path() + ")"
769 })
770 }
771
772 fn short_type_path() -> &'static str {
773 use $crate::__macro_exports::alloc_utils::ToOwned;
774 static CELL: GenericTypePathCell = GenericTypePathCell::new();
775 CELL.get_or_insert::<Self, _>(|| {
776 "(".to_owned() $(+ $param::short_type_path() + ", ")* + $last::short_type_path() + ")"
777 })
778 }
779 }
780 };
781}
782
783impl TypePath for () {
fn type_path() -> &'static str { "()" }
fn short_type_path() -> &'static str { "()" }
}
#[doc(fake_variadic)]
#[doc = "This trait is implemented for tuples up to 12 items long."]
impl<P: TypePath> TypePath for (P,) {
fn type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(|| { "(".to_owned() + P::type_path() + ",)" })
}
fn short_type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(|| { "(".to_owned() + P::short_type_path() + ",)" })
}
}
#[doc(hidden)]
impl<P1: TypePath, P0: TypePath> TypePath for (P1, P0) {
fn type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(||
{
"(".to_owned() + P1::type_path() + ", " + P0::type_path() +
")"
})
}
fn short_type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(||
{
"(".to_owned() + P1::short_type_path() + ", " +
P0::short_type_path() + ")"
})
}
}
#[doc(hidden)]
impl<P1: TypePath, P2: TypePath, P0: TypePath> TypePath for (P1, P2, P0) {
fn type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(||
{
"(".to_owned() + P1::type_path() + ", " + P2::type_path() +
", " + P0::type_path() + ")"
})
}
fn short_type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(||
{
"(".to_owned() + P1::short_type_path() + ", " +
P2::short_type_path() + ", " + P0::short_type_path() + ")"
})
}
}
#[doc(hidden)]
impl<P1: TypePath, P2: TypePath, P3: TypePath, P0: TypePath> TypePath for
(P1, P2, P3, P0) {
fn type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(||
{
"(".to_owned() + P1::type_path() + ", " + P2::type_path() +
", " + P3::type_path() + ", " + P0::type_path() + ")"
})
}
fn short_type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(||
{
"(".to_owned() + P1::short_type_path() + ", " +
P2::short_type_path() + ", " + P3::short_type_path() + ", "
+ P0::short_type_path() + ")"
})
}
}
#[doc(hidden)]
impl<P1: TypePath, P2: TypePath, P3: TypePath, P4: TypePath, P0: TypePath>
TypePath for (P1, P2, P3, P4, P0) {
fn type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(||
{
"(".to_owned() + P1::type_path() + ", " + P2::type_path() +
", " + P3::type_path() + ", " + P4::type_path() + ", " +
P0::type_path() + ")"
})
}
fn short_type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(||
{
"(".to_owned() + P1::short_type_path() + ", " +
P2::short_type_path() + ", " + P3::short_type_path() + ", "
+ P4::short_type_path() + ", " + P0::short_type_path() + ")"
})
}
}
#[doc(hidden)]
impl<P1: TypePath, P2: TypePath, P3: TypePath, P4: TypePath, P5: TypePath,
P0: TypePath> TypePath for (P1, P2, P3, P4, P5, P0) {
fn type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(||
{
"(".to_owned() + P1::type_path() + ", " + P2::type_path() +
", " + P3::type_path() + ", " + P4::type_path() + ", " +
P5::type_path() + ", " + P0::type_path() + ")"
})
}
fn short_type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(||
{
"(".to_owned() + P1::short_type_path() + ", " +
P2::short_type_path() + ", " + P3::short_type_path() + ", "
+ P4::short_type_path() + ", " + P5::short_type_path() +
", " + P0::short_type_path() + ")"
})
}
}
#[doc(hidden)]
impl<P1: TypePath, P2: TypePath, P3: TypePath, P4: TypePath, P5: TypePath,
P6: TypePath, P0: TypePath> TypePath for (P1, P2, P3, P4, P5, P6, P0) {
fn type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(||
{
"(".to_owned() + P1::type_path() + ", " + P2::type_path() +
", " + P3::type_path() + ", " + P4::type_path() + ", " +
P5::type_path() + ", " + P6::type_path() + ", " +
P0::type_path() + ")"
})
}
fn short_type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(||
{
"(".to_owned() + P1::short_type_path() + ", " +
P2::short_type_path() + ", " + P3::short_type_path() + ", "
+ P4::short_type_path() + ", " + P5::short_type_path() +
", " + P6::short_type_path() + ", " + P0::short_type_path()
+ ")"
})
}
}
#[doc(hidden)]
impl<P1: TypePath, P2: TypePath, P3: TypePath, P4: TypePath, P5: TypePath,
P6: TypePath, P7: TypePath, P0: TypePath> TypePath for
(P1, P2, P3, P4, P5, P6, P7, P0) {
fn type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(||
{
"(".to_owned() + P1::type_path() + ", " + P2::type_path() +
", " + P3::type_path() + ", " + P4::type_path() + ", " +
P5::type_path() + ", " + P6::type_path() + ", " +
P7::type_path() + ", " + P0::type_path() + ")"
})
}
fn short_type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(||
{
"(".to_owned() + P1::short_type_path() + ", " +
P2::short_type_path() + ", " + P3::short_type_path() + ", "
+ P4::short_type_path() + ", " + P5::short_type_path() +
", " + P6::short_type_path() + ", " + P7::short_type_path()
+ ", " + P0::short_type_path() + ")"
})
}
}
#[doc(hidden)]
impl<P1: TypePath, P2: TypePath, P3: TypePath, P4: TypePath, P5: TypePath,
P6: TypePath, P7: TypePath, P8: TypePath, P0: TypePath> TypePath for
(P1, P2, P3, P4, P5, P6, P7, P8, P0) {
fn type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(||
{
"(".to_owned() + P1::type_path() + ", " + P2::type_path() +
", " + P3::type_path() + ", " + P4::type_path() + ", " +
P5::type_path() + ", " + P6::type_path() + ", " +
P7::type_path() + ", " + P8::type_path() + ", " +
P0::type_path() + ")"
})
}
fn short_type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(||
{
"(".to_owned() + P1::short_type_path() + ", " +
P2::short_type_path() + ", " + P3::short_type_path() + ", "
+ P4::short_type_path() + ", " + P5::short_type_path() +
", " + P6::short_type_path() + ", " + P7::short_type_path()
+ ", " + P8::short_type_path() + ", " +
P0::short_type_path() + ")"
})
}
}
#[doc(hidden)]
impl<P1: TypePath, P2: TypePath, P3: TypePath, P4: TypePath, P5: TypePath,
P6: TypePath, P7: TypePath, P8: TypePath, P9: TypePath, P0: TypePath>
TypePath for (P1, P2, P3, P4, P5, P6, P7, P8, P9, P0) {
fn type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(||
{
"(".to_owned() + P1::type_path() + ", " + P2::type_path() +
", " + P3::type_path() + ", " + P4::type_path() + ", " +
P5::type_path() + ", " + P6::type_path() + ", " +
P7::type_path() + ", " + P8::type_path() + ", " +
P9::type_path() + ", " + P0::type_path() + ")"
})
}
fn short_type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(||
{
"(".to_owned() + P1::short_type_path() + ", " +
P2::short_type_path() + ", " + P3::short_type_path() + ", "
+ P4::short_type_path() + ", " + P5::short_type_path() +
", " + P6::short_type_path() + ", " + P7::short_type_path()
+ ", " + P8::short_type_path() + ", " +
P9::short_type_path() + ", " + P0::short_type_path() + ")"
})
}
}
#[doc(hidden)]
impl<P1: TypePath, P2: TypePath, P3: TypePath, P4: TypePath, P5: TypePath,
P6: TypePath, P7: TypePath, P8: TypePath, P9: TypePath, P10: TypePath,
P0: TypePath> TypePath for (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P0) {
fn type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(||
{
"(".to_owned() + P1::type_path() + ", " + P2::type_path() +
", " + P3::type_path() + ", " + P4::type_path() + ", " +
P5::type_path() + ", " + P6::type_path() + ", " +
P7::type_path() + ", " + P8::type_path() + ", " +
P9::type_path() + ", " + P10::type_path() + ", " +
P0::type_path() + ")"
})
}
fn short_type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(||
{
"(".to_owned() + P1::short_type_path() + ", " +
P2::short_type_path() + ", " + P3::short_type_path() + ", "
+ P4::short_type_path() + ", " + P5::short_type_path() +
", " + P6::short_type_path() + ", " + P7::short_type_path()
+ ", " + P8::short_type_path() + ", " +
P9::short_type_path() + ", " + P10::short_type_path() + ", "
+ P0::short_type_path() + ")"
})
}
}
#[doc(hidden)]
impl<P1: TypePath, P2: TypePath, P3: TypePath, P4: TypePath, P5: TypePath,
P6: TypePath, P7: TypePath, P8: TypePath, P9: TypePath, P10: TypePath,
P11: TypePath, P0: TypePath> TypePath for
(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P0) {
fn type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(||
{
"(".to_owned() + P1::type_path() + ", " + P2::type_path() +
", " + P3::type_path() + ", " + P4::type_path() + ", " +
P5::type_path() + ", " + P6::type_path() + ", " +
P7::type_path() + ", " + P8::type_path() + ", " +
P9::type_path() + ", " + P10::type_path() + ", " +
P11::type_path() + ", " + P0::type_path() + ")"
})
}
fn short_type_path() -> &'static str {
use crate::__macro_exports::alloc_utils::ToOwned;
static CELL: GenericTypePathCell = GenericTypePathCell::new();
CELL.get_or_insert::<Self,
_>(||
{
"(".to_owned() + P1::short_type_path() + ", " +
P2::short_type_path() + ", " + P3::short_type_path() + ", "
+ P4::short_type_path() + ", " + P5::short_type_path() +
", " + P6::short_type_path() + ", " + P7::short_type_path()
+ ", " + P8::short_type_path() + ", " +
P9::short_type_path() + ", " + P10::short_type_path() + ", "
+ P11::short_type_path() + ", " + P0::short_type_path() +
")"
})
}
}all_tuples!(
784 #[doc(fake_variadic)]
785 impl_type_path_tuple,
786 0,
787 12,
788 P
789);
790
791#[cfg(feature = "functions")]
792const _: () = {
793 macro_rules! impl_get_ownership_tuple {
794 ($(#[$meta:meta])* $($name: ident),*) => {
795 $(#[$meta])*
796 $crate::func::args::impl_get_ownership!(($($name,)*); <$($name),*>);
797 };
798}
799
800 impl<P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11>
crate::func::args::GetOwnership for
(P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11) {}all_tuples!(
801 #[doc(fake_variadic)]
802 impl_get_ownership_tuple,
803 0,
804 12,
805 P
806 );
807
808 macro_rules! impl_from_arg_tuple {
809 ($(#[$meta:meta])* $($name: ident),*) => {
810 $(#[$meta])*
811 $crate::func::args::impl_from_arg!(($($name,)*); <$($name: FromReflect + MaybeTyped + TypePath + GetTypeRegistration),*>);
812 };
813}
814
815 impl<P0: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
P1: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
P2: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
P3: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
P4: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
P5: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
P6: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
P7: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
P8: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
P9: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
P10: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
P11: FromReflect + MaybeTyped + TypePath + GetTypeRegistration>
crate::func::args::FromArg for
(P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11) {
type This<'from_arg> = (P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11);
fn from_arg(arg: crate::func::args::Arg<'_>)
-> Result<Self::This<'_>, crate::func::args::ArgError> {
arg.take_owned()
}
}all_tuples!(
816 #[doc(fake_variadic)]
817 impl_from_arg_tuple,
818 0,
819 12,
820 P
821 );
822
823 macro_rules! impl_into_return_tuple {
824 ($(#[$meta:meta])* $($name: ident),+) => {
825 $(#[$meta])*
826 $crate::func::impl_into_return!(($($name,)*); <$($name: FromReflect + MaybeTyped + TypePath + GetTypeRegistration),*>);
827 };
828}
829
830 impl<P0: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
P1: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
P2: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
P3: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
P4: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
P5: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
P6: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
P7: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
P8: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
P9: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
P10: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
P11: FromReflect + MaybeTyped + TypePath + GetTypeRegistration>
crate::func::IntoReturn for
(P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11) {
fn into_return<'into_return>(self) -> crate::func::Return<'into_return>
where Self: 'into_return {
crate::func::Return::Owned(bevy_platform::prelude::Box::new(self))
}
}all_tuples!(
832 #[doc(fake_variadic)]
833 impl_into_return_tuple,
834 1,
835 12,
836 P
837 );
838};
839
840#[cfg(test)]
841mod tests {
842 use super::Tuple;
843
844 #[test]
845 fn next_index_increment() {
846 let mut iter = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11).iter_fields();
847 let size = iter.len();
848 iter.index = size - 1;
849 let prev_index = iter.index;
850 assert!(iter.next().is_some());
851 assert_eq!(prev_index, iter.index - 1);
852
853 assert!(iter.next().is_none());
855 assert_eq!(size, iter.index);
856 assert!(iter.next().is_none());
857 assert_eq!(size, iter.index);
858 }
859}