pub trait ComponentFallbackProvider {
// Required method
fn try_provide_fallback(
&self,
ctx: &QueryContext<'_>,
component: ComponentName
) -> ComponentFallbackProviderResult;
// Provided method
fn fallback_for(
&self,
ctx: &QueryContext<'_>,
component: ComponentName
) -> Box<dyn Array> { ... }
}
Expand description
Provides fallback values for components, implemented typically by crate::SpaceViewClass
and crate::VisualizerSystem
.
Fallbacks can be based on arbitrarily complex & context sensitive heuristics.
Required Methods§
sourcefn try_provide_fallback(
&self,
ctx: &QueryContext<'_>,
component: ComponentName
) -> ComponentFallbackProviderResult
fn try_provide_fallback( &self, ctx: &QueryContext<'_>, component: ComponentName ) -> ComponentFallbackProviderResult
Tries to provide a fallback value for a given component.
If the provider can’t handle the component or simply want to use a placeholder value,
it should return ComponentFallbackProviderResult::ComponentNotHandled
.
Fallbacks can be based on arbitrarily complex & context sensitive heuristics.
Provided Methods§
sourcefn fallback_for(
&self,
ctx: &QueryContext<'_>,
component: ComponentName
) -> Box<dyn Array>
fn fallback_for( &self, ctx: &QueryContext<'_>, component: ComponentName ) -> Box<dyn Array>
Provides a fallback value for a given component, first trying the provider and then falling back to the placeholder value registered in the viewer context.