mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
[ecs] add StorageType
documentation (#2394)
# Objective - Add inline documentation for `StorageType`. - Currently the README in `bevy_ecs` provides docs for `StorageType`, however, adding addition inline docs makes it simpler for users who are actively reading the source code. ## Solution - Add inline docs.
This commit is contained in:
parent
10f2dd3ec5
commit
c8e2415eaf
1 changed files with 16 additions and 0 deletions
|
@ -26,9 +26,25 @@ use thiserror::Error;
|
|||
pub trait Component: Send + Sync + 'static {}
|
||||
impl<T: Send + Sync + 'static> Component for T {}
|
||||
|
||||
/// The storage used for a specific component type.
|
||||
///
|
||||
/// # Examples
|
||||
/// The [`StorageType`] for a component is normally configured via `World::register_component`.
|
||||
///
|
||||
/// ```
|
||||
/// # use bevy_ecs::{prelude::*, component::*};
|
||||
///
|
||||
/// struct A;
|
||||
///
|
||||
/// let mut world = World::default();
|
||||
/// world.register_component(ComponentDescriptor::new::<A>(StorageType::SparseSet));
|
||||
/// ```
|
||||
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
||||
pub enum StorageType {
|
||||
/// Provides fast and cache-friendly iteration, but slower addition and removal of components.
|
||||
/// This is the default storage type.
|
||||
Table,
|
||||
/// Provides fast addition and removal of components, but slower iteration.
|
||||
SparseSet,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue