Improve eframe wasm32 docs

This commit is contained in:
Emil Ernerfeldt 2022-12-11 16:52:37 +01:00
parent 0a1b85f35a
commit 4e3ae098a9
3 changed files with 7 additions and 5 deletions

View file

@ -17,6 +17,7 @@ include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"]
# Avoid speech-dispatcher dependencies - see https://docs.rs/crate/eframe/0.20.0/builds/695200 # Avoid speech-dispatcher dependencies - see https://docs.rs/crate/eframe/0.20.0/builds/695200
no-default-features = true no-default-features = true
features = ["document-features", "glow", "wgpu", "persistence", "wgpu"] features = ["document-features", "glow", "wgpu", "persistence", "wgpu"]
targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]
[lib] [lib]

View file

@ -74,7 +74,7 @@ pub trait App {
/// ///
/// Can be used from web to interact or other external context. /// Can be used from web to interact or other external context.
/// ///
/// You need to implement this if you want to be able to access the application from JS using [`AppRunner::app_mut`]. /// You need to implement this if you want to be able to access the application from JS using [`crate::web::backend::AppRunner`].
/// ///
/// This is needed because downcasting `Box<dyn App>` -> `Box<dyn Any>` to get &`ConcreteApp` is not simple in current rust. /// This is needed because downcasting `Box<dyn App>` -> `Box<dyn Any>` to get &`ConcreteApp` is not simple in current rust.
/// ///

View file

@ -1,12 +1,13 @@
use super::{web_painter::WebPainter, *};
use crate::epi;
use egui::{ use egui::{
mutex::{Mutex, MutexGuard}, mutex::{Mutex, MutexGuard},
TexturesDelta, TexturesDelta,
}; };
pub use egui::{pos2, Color32}; pub use egui::{pos2, Color32};
use crate::{epi, App};
use super::{web_painter::WebPainter, *};
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
/// Data gathered between frames. /// Data gathered between frames.
@ -284,7 +285,7 @@ impl AppRunner {
/// Get mutable access to the concrete [`App`] we enclose. /// Get mutable access to the concrete [`App`] we enclose.
/// ///
/// This will panic if your app does not implement [`App::as_any_mut`]. /// This will panic if your app does not implement [`App::as_any_mut`].
pub fn app_mut<ConreteApp: 'static + crate::App>(&mut self) -> &mut ConreteApp { pub fn app_mut<ConreteApp: 'static + App>(&mut self) -> &mut ConreteApp {
self.app self.app
.as_any_mut() .as_any_mut()
.expect("Your app must implement `as_any_mut`, but it doesn't") .expect("Your app must implement `as_any_mut`, but it doesn't")