Skip to content

Commit

Permalink
Improve eframe wasm32 docs
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Dec 11, 2022
1 parent 0a1b85f commit 4e3ae09
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions crates/eframe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
no-default-features = true
features = ["document-features", "glow", "wgpu", "persistence", "wgpu"]
targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]

[lib]

Expand Down
2 changes: 1 addition & 1 deletion crates/eframe/src/epi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub trait App {
///
/// 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.
///
Expand Down
9 changes: 5 additions & 4 deletions crates/eframe/src/web/backend.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use super::{web_painter::WebPainter, *};
use crate::epi;

use egui::{
mutex::{Mutex, MutexGuard},
TexturesDelta,
};
pub use egui::{pos2, Color32};

use crate::{epi, App};

use super::{web_painter::WebPainter, *};

// ----------------------------------------------------------------------------

/// Data gathered between frames.
Expand Down Expand Up @@ -284,7 +285,7 @@ impl AppRunner {
/// Get mutable access to the concrete [`App`] we enclose.
///
/// 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
.as_any_mut()
.expect("Your app must implement `as_any_mut`, but it doesn't")
Expand Down

0 comments on commit 4e3ae09

Please sign in to comment.