Skip to content

Commit

Permalink
Update documentation for Reflectable
Browse files Browse the repository at this point in the history
  • Loading branch information
MrGVSV committed Sep 21, 2022
1 parent dabbc17 commit be039c6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/bevy_reflect/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub use type_info::*;
pub use type_registry::*;
pub use type_uuid::*;

/// A catch-all trait bound by the core reflection traits for easy reflection-based trait bounds.
/// A catch-all trait, bound by the core reflection traits for easy reflection-based trait bounds.
///
/// You do _not_ need to implement this trait manually.
/// It is automatically implemented for all types that implement its supertraits.
Expand Down
6 changes: 6 additions & 0 deletions crates/bevy_reflect/src/reflect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ pub enum ReflectMut<'a> {
///
/// When using `#[derive(Reflect)]` on a struct, tuple struct or enum, the suitable subtrait for that
/// type (`Struct`, `TupleStruct` or `Enum`) is derived automatically.
///
/// Typically, generic types will require that their generic arguments be bound by `Reflect`, among
/// other reflection traits. In these cases, it's recommended to use the [`Reflectable`] trait to
/// cover all the necessary bounds.
///
/// [`Reflectable`]: crate::Reflectable
pub trait Reflect: Any + Send + Sync {
/// Returns the [type name][std::any::type_name] of the underlying type.
fn type_name(&self) -> &str;
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_reflect/src/type_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ use std::any::{Any, TypeId};
/// This trait is automatically implemented by the `#[derive(Reflect)]` macro
/// and allows type information to be processed without an instance of that type.
///
/// As a core trait to the reflection system, it is a supertrait of [`Reflectable`].
///
/// # Implementing
///
/// While it is recommended to leave implementing this trait to the `#[derive(Reflect)]` macro,
Expand Down Expand Up @@ -63,6 +65,7 @@ use std::any::{Any, TypeId};
/// # }
/// ```
///
/// [`Reflectable`]: crate::Reflectable
/// [utility]: crate::utility
pub trait Typed: Reflect {
/// Returns the compile-time [info] for the underlying type.
Expand Down
4 changes: 4 additions & 0 deletions crates/bevy_reflect/src/type_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ impl Debug for TypeRegistryArc {
/// A trait which allows a type to generate its [`TypeRegistration`].
///
/// This trait is automatically implemented for types which derive [`Reflect`].
///
/// As a core trait to the reflection system, it is a supertrait of [`Reflectable`].
///
/// [`Reflectable`]: crate::Reflectable
pub trait GetTypeRegistration {
fn get_type_registration() -> TypeRegistration;
}
Expand Down

0 comments on commit be039c6

Please sign in to comment.