mirror of
https://github.com/bevyengine/bevy
synced 2024-11-25 06:00:20 +00:00
bevy_reflect: Add crate level functions
feature docs (#15086)
Adds the missing section for the `functions` cargo feature of the `bevy_reflect` crate.
This commit is contained in:
parent
e19c53ebbd
commit
0b2e0cfaca
1 changed files with 19 additions and 8 deletions
|
@ -454,15 +454,11 @@
|
|||
//! but [`Reflect`] requires all types to have a `'static` lifetime.
|
||||
//! This makes it impossible to reflect any type with non-static borrowed data.
|
||||
//!
|
||||
//! ## Function Reflection
|
||||
//! ## Generic Function Reflection
|
||||
//!
|
||||
//! Another limitation is the inability to fully reflect functions and methods.
|
||||
//! Most languages offer some way of calling methods dynamically,
|
||||
//! but Rust makes this very difficult to do.
|
||||
//! For non-generic methods, this can be done by registering custom [type data] that
|
||||
//! contains function pointers.
|
||||
//! For generic methods, the same can be done but will typically require manual monomorphization
|
||||
//! (i.e. manually specifying the types the generic method can take).
|
||||
//! Another limitation is the inability to reflect over generic functions directly. It can be done, but will
|
||||
//! typically require manual monomorphization (i.e. manually specifying the types the generic method can
|
||||
//! take).
|
||||
//!
|
||||
//! ## Manual Registration
|
||||
//!
|
||||
|
@ -485,6 +481,17 @@
|
|||
//! These dependencies are used by the [Bevy] game engine and must define their reflection implementations
|
||||
//! within this crate due to Rust's [orphan rule].
|
||||
//!
|
||||
//! ## `functions`
|
||||
//!
|
||||
//! | Default | Dependencies |
|
||||
//! | :-----: | :-------------------------------: |
|
||||
//! | ❌ | [`bevy_reflect_derive/functions`] |
|
||||
//!
|
||||
//! This feature allows creating a [`DynamicFunction`] or [`DynamicFunctionMut`] from Rust functions. Dynamic
|
||||
//! functions can then be called with valid [`ArgList`]s.
|
||||
//!
|
||||
//! For more information, read the [`func`] module docs.
|
||||
//!
|
||||
//! ## `documentation`
|
||||
//!
|
||||
//! | Default | Dependencies |
|
||||
|
@ -540,6 +547,10 @@
|
|||
//! [`smallvec`]: https://docs.rs/smallvec/latest/smallvec/
|
||||
//! [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.
|
||||
//! [`bevy_reflect_derive/documentation`]: bevy_reflect_derive
|
||||
//! [`bevy_reflect_derive/functions`]: bevy_reflect_derive
|
||||
//! [`DynamicFunction`]: crate::func::DynamicFunction
|
||||
//! [`DynamicFunctionMut`]: crate::func::DynamicFunctionMut
|
||||
//! [`ArgList`]: crate::func::ArgList
|
||||
//! [derive `Reflect`]: derive@crate::Reflect
|
||||
|
||||
extern crate alloc;
|
||||
|
|
Loading…
Reference in a new issue