Function rerun::external::eframe::run_native

pub fn run_native(
    app_name: &str,
    native_options: NativeOptions,
    app_creator: Box<dyn FnOnce(&CreationContext<'_>) -> Result<Box<dyn App + '_>, Box<dyn Error + Sync + Send>> + '_>
) -> Result<(), Error>
Expand description

This is how you start a native (desktop) app.

The first argument is name of your app, which is a an identifier used for the save location of persistence (see App::save). It is also used as the application id on wayland. If you set no title on the viewport, the app id will be used as the title.

For details about application ID conventions, see the Desktop Entry Spec

Call from fn main like this:

use eframe::egui;

fn main() -> eframe::Result {
    let native_options = eframe::NativeOptions::default();
    eframe::run_native("MyApp", native_options, Box::new(|cc| Ok(Box::new(MyEguiApp::new(cc)))))
}

#[derive(Default)]
struct MyEguiApp {}

impl MyEguiApp {
    fn new(cc: &eframe::CreationContext<'_>) -> Self {
        // Customize egui here with cc.egui_ctx.set_fonts and cc.egui_ctx.set_visuals.
        // Restore app state using cc.storage (requires the "persistence" feature).
        // Use the cc.gl (a glow::Context) to create graphics shaders and buffers that you can use
        // for e.g. egui::PaintCallback.
        Self::default()
    }
}

impl eframe::App for MyEguiApp {
   fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
       egui::CentralPanel::default().show(ctx, |ui| {
           ui.heading("Hello World!");
       });
   }
}

§Errors

This function can fail if we fail to set up a graphics context.