Skip to main content

IntoLayoutEditor

Trait IntoLayoutEditor 

Source
pub trait IntoLayoutEditor {
    // Required method
    fn into_editor<P: Params + 'static>(
        self,
        params: &Arc<P>,
    ) -> Box<dyn Editor>;
}
Expand description

Fluent shorthand for default_editor. Build a GridLayout, then close the editor() impl with .into_editor(&self.params):

fn editor(&self) -> Box<dyn truce_core::Editor> {
    GridLayout::build(vec![ /* widgets */ ])
        .with_title("GAIN")
        .into_editor(&self.params)
}

Equivalent to default_editor(self.params.clone(), layout) - the &Arc<P> is cloned internally so the call site stays free of an explicit .clone(). Bring it into scope with use truce_gui::IntoLayoutEditor; (it can’t ride along on truce::prelude, which deliberately doesn’t depend on this crate).

The method name mirrors truce_core::IntoEditor::into_editor (the blanket “box a concrete editor” helper used by egui / iced / slint), so every editor() impl ends the same way - layout plugins just pass their params.

Same feature gating as default_editor: only compiled when a renderer feature (cpu / gpu) is on, or on iOS.

Required Methods§

Source

fn into_editor<P: Params + 'static>(self, params: &Arc<P>) -> Box<dyn Editor>

Wrap this layout in truce’s default editor, picking the renderer from the active truce-gui feature. See default_editor.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl IntoLayoutEditor for GridLayout

Available on iOS or crate feature cpu or crate feature gpu only.