|
454 | 454 | //! but [`Reflect`] requires all types to have a `'static` lifetime.
|
455 | 455 | //! This makes it impossible to reflect any type with non-static borrowed data.
|
456 | 456 | //!
|
457 |
| -//! ## Function Reflection |
| 457 | +//! ## Generic Function Reflection |
458 | 458 | //!
|
459 |
| -//! Another limitation is the inability to fully reflect functions and methods. |
460 |
| -//! Most languages offer some way of calling methods dynamically, |
461 |
| -//! but Rust makes this very difficult to do. |
462 |
| -//! For non-generic methods, this can be done by registering custom [type data] that |
463 |
| -//! contains function pointers. |
464 |
| -//! For generic methods, the same can be done but will typically require manual monomorphization |
465 |
| -//! (i.e. manually specifying the types the generic method can take). |
| 459 | +//! Another limitation is the inability to reflect over generic functions directly. It can be done, but will |
| 460 | +//! typically require manual monomorphization (i.e. manually specifying the types the generic method can |
| 461 | +//! take). |
466 | 462 | //!
|
467 | 463 | //! ## Manual Registration
|
468 | 464 | //!
|
|
485 | 481 | //! These dependencies are used by the [Bevy] game engine and must define their reflection implementations
|
486 | 482 | //! within this crate due to Rust's [orphan rule].
|
487 | 483 | //!
|
| 484 | +//! ## `functions` |
| 485 | +//! |
| 486 | +//! | Default | Dependencies | |
| 487 | +//! | :-----: | :-------------------------------: | |
| 488 | +//! | ❌ | [`bevy_reflect_derive/functions`] | |
| 489 | +//! |
| 490 | +//! This feature allows creating a [`DynamicFunction`] or [`DynamicFunctionMut`] from Rust functions. Dynamic |
| 491 | +//! functions can then be called with valid [`ArgList`]s. |
| 492 | +//! |
| 493 | +//! For more information, read the [`func`] module docs. |
| 494 | +//! |
488 | 495 | //! ## `documentation`
|
489 | 496 | //!
|
490 | 497 | //! | Default | Dependencies |
|
|
540 | 547 | //! [`smallvec`]: https://docs.rs/smallvec/latest/smallvec/
|
541 | 548 | //! [orphan rule]: https://doc.rust-lang.org/book/ch10-02-traits.html#implementing-a-trait-on-a-type:~:text=But%20we%20can%E2%80%99t,implementation%20to%20use.
|
542 | 549 | //! [`bevy_reflect_derive/documentation`]: bevy_reflect_derive
|
| 550 | +//! [`bevy_reflect_derive/functions`]: bevy_reflect_derive |
| 551 | +//! [`DynamicFunction`]: crate::func::DynamicFunction |
| 552 | +//! [`DynamicFunctionMut`]: crate::func::DynamicFunctionMut |
| 553 | +//! [`ArgList`]: crate::func::ArgList |
543 | 554 | //! [derive `Reflect`]: derive@crate::Reflect
|
544 | 555 |
|
545 | 556 | extern crate alloc;
|
|
0 commit comments