#[derive(Clone)] on Component{Info,Descriptor} (#9812)
# Objective Occasionally, it is useful to pull `ComponentInfo` or `ComponentDescriptor` out of the `Components` collection so that they can be inspected without borrowing the whole `World`. ## Solution Make `ComponentInfo` and `ComponentDescriptor` `Clone`, so that reflection-heavy code can store them in a side table. --- ## Changelog - Implement `Clone` for `ComponentInfo` and `ComponentDescriptor`
This commit is contained in:
parent
3ee9edf280
commit
e07c427dea
@ -202,7 +202,7 @@ pub enum StorageType {
|
||||
}
|
||||
|
||||
/// Stores metadata for a type of component or resource stored in a specific [`World`].
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ComponentInfo {
|
||||
id: ComponentId,
|
||||
descriptor: ComponentDescriptor,
|
||||
@ -319,6 +319,7 @@ impl SparseSetIndex for ComponentId {
|
||||
}
|
||||
|
||||
/// A value describing a component or resource, which may or may not correspond to a Rust type.
|
||||
#[derive(Clone)]
|
||||
pub struct ComponentDescriptor {
|
||||
name: Cow<'static, str>,
|
||||
// SAFETY: This must remain private. It must match the statically known StorageType of the
|
||||
|
||||
Loading…
Reference in New Issue
Block a user