pub fn default_editor<P: Params + 'static>(
params: Arc<P>,
layout: GridLayout,
) -> Box<dyn Editor>Expand description
Construct truce’s default editor for a plugin’s editor() impl.
Picks the renderer based on which feature is enabled:
gpu(opt-in): wraps aBuiltinEditorin aGpuEditorthat renders directly throughtruce_gpu::WgpuBackend.cpu(default): returns aBuiltinEditorwhoseEditorimpl rasterises to a tiny-skia pixmap and blits it to a wgpu surface.- iOS: always returns the iOS
BuiltinEditor(UIView-hostedCAMetalLayer); thegpufeature has no effect on iOS.
Most layout-only plugins implement truce_plugin::PluginLogic::editor as:
ⓘ
fn editor(&self) -> Box<dyn truce_core::Editor> {
truce_gui::default_editor(
self.params.clone(),
GridLayout::build(vec![ /* widgets */ ]),
)
}Only compiled when a renderer feature (cpu or gpu) is on.
Crates that depend on truce-gui purely for its types / platform
helpers (e.g. truce-egui, truce-iced, truce-slint) can build
it with neither feature and simply not call this function.