pub trait IndexStorage<I: IndexInfo>: Resource + Default {
type RefreshData<'w, 's>: SystemParam;
// Required methods
fn lookup<'w, 's>(
&mut self,
val: &I::Value,
data: &mut StaticSystemParam<'_, '_, Self::RefreshData<'w, 's>>,
) -> impl Iterator<Item = Entity>;
fn refresh<'w, 's>(
&mut self,
data: &mut StaticSystemParam<'_, '_, Self::RefreshData<'w, 's>>,
);
fn force_refresh<'w, 's>(
&mut self,
data: &mut StaticSystemParam<'_, '_, Self::RefreshData<'w, 's>>,
);
fn insertion_observer() -> Option<Observer>;
fn removal_observer() -> Option<Observer>;
}Expand description
Defines the internal storage for an index, which is stored as a Resource.
You should not need this for normal use beyond including the Storage type
in your IndexInfo implementations, but you can use this to customize
the storage of your index’s data if necessary
This crate provides the following storage implementations:
Required Associated Types§
Sourcetype RefreshData<'w, 's>: SystemParam
type RefreshData<'w, 's>: SystemParam
SystemParam that is fetched alongside this storage Resource when
an Index is included in a system.
It is passed in when querying or updating the index.
Required Methods§
Sourcefn lookup<'w, 's>(
&mut self,
val: &I::Value,
data: &mut StaticSystemParam<'_, '_, Self::RefreshData<'w, 's>>,
) -> impl Iterator<Item = Entity>
fn lookup<'w, 's>( &mut self, val: &I::Value, data: &mut StaticSystemParam<'_, '_, Self::RefreshData<'w, 's>>, ) -> impl Iterator<Item = Entity>
Get all of the entities with relevant components that evaluate to the given value
using I::value.
Sourcefn refresh<'w, 's>(
&mut self,
data: &mut StaticSystemParam<'_, '_, Self::RefreshData<'w, 's>>,
)
fn refresh<'w, 's>( &mut self, data: &mut StaticSystemParam<'_, '_, Self::RefreshData<'w, 's>>, )
Sourcefn force_refresh<'w, 's>(
&mut self,
data: &mut StaticSystemParam<'_, '_, Self::RefreshData<'w, 's>>,
)
fn force_refresh<'w, 's>( &mut self, data: &mut StaticSystemParam<'_, '_, Self::RefreshData<'w, 's>>, )
Unconditionally refresh this storage with the latest state from the world.
Sourcefn insertion_observer() -> Option<Observer>
fn insertion_observer() -> Option<Observer>
Observer to be run whenever a component tracked by this Index is inserted.
No observer will be registered if this returns None.
Sourcefn removal_observer() -> Option<Observer>
fn removal_observer() -> Option<Observer>
Observer to be run whenever a component tracked by this Index is removed.
No observer will be registered if this returns None.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.