pub trait MapComponent<T: Component>:
'static
+ Clone
+ Send
+ Sync {
type Output: Component;
// Required method
fn map_component(&self, component: &T) -> Self::Output;
}Expand description
A trait used for mapping components during a save operation.
§Usage
Component mapping is useful when you wish to serialize an unserializable component.
All component mappers are executed BEFORE the serialization step of the Save Pipeline.
When invoked, the given component T will be replaced with the output of the mapper for all saved entities.
When the save operation is complete, the original component will be restored.
Keep in mind that this will trigger change detection for the mapped component.
Required Associated Types§
Required Methods§
Sourcefn map_component(&self, component: &T) -> Self::Output
fn map_component(&self, component: &T) -> Self::Output
Called during the Save/Load process to map components.
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.