docs.rs failed to build eframe_tao-0.20.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
eframe_tao-0.20.0
eframe - the [egui
] framework crate
If you are planning to write an app for web or native,
and want to use [egui
] for everything, then eframe
is for you!
To get started, see the examples.
To learn how to set up eframe
for web and native, go to https://github.com/emilk/eframe_template/ and follow the instructions there!
In short, you implement [App
] (especially [App::update
]) and then
call [crate::run_native
] from your main.rs
, and/or call eframe::start_web
from your lib.rs
.
Usage, native:
use eframe::egui;
fn main() {
let native_options = eframe::NativeOptions::default();
eframe::run_native("My egui App", native_options, Box::new(|cc| 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!");
});
}
}
Usage, web:
#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;
/// Call this once from the HTML.
#[cfg(target_arch = "wasm32")]
#[wasm_bindgen]
pub fn start(canvas_id: &str) -> Result<AppRunnerRef, eframe::wasm_bindgen::JsValue> {
let web_options = eframe::WebOptions::default();
eframe::start_web(canvas_id, web_options, Box::new(|cc| Box::new(MyEguiApp::new(cc))))
}