Skip to content
Snippets Groups Projects
Unverified Commit 5c06f8e2 authored by scratchyone's avatar scratchyone
Browse files

Update docs to use Fn instead of FnMut

parent 18590c26
No related branches found
No related tags found
No related merge requests found
...@@ -77,7 +77,7 @@ fn main() -> Result<(), WebSocketError> { ...@@ -77,7 +77,7 @@ fn main() -> Result<(), WebSocketError> {
} }
// receive() gives you all new websocket messages since receive() was last called // receive() gives you all new websocket messages since receive() was last called
info!("New messages: {:#?}", client.borrow_mut().receive()); info!("New messages: {:#?}", client.borrow_mut().receive());
}) as Box<dyn FnMut()>); }) as Box<dyn Fn()>);
// Start non-blocking game loop // Start non-blocking game loop
setInterval(&f, 100); setInterval(&f, 100);
...@@ -88,6 +88,6 @@ fn main() -> Result<(), WebSocketError> { ...@@ -88,6 +88,6 @@ fn main() -> Result<(), WebSocketError> {
// Bind setInterval to make a basic game loop // Bind setInterval to make a basic game loop
#[wasm_bindgen] #[wasm_bindgen]
extern "C" { extern "C" {
fn setInterval(closure: &Closure<dyn FnMut()>, time: u32) -> i32; fn setInterval(closure: &Closure<dyn Fn()>, time: u32) -> i32;
} }
``` ```
...@@ -27,7 +27,7 @@ fn main() -> Result<(), WebSocketError> { ...@@ -27,7 +27,7 @@ fn main() -> Result<(), WebSocketError> {
} }
// receive() gives you all new websocket messages since receive() was last called // receive() gives you all new websocket messages since receive() was last called
info!("New messages: {:#?}", client.borrow_mut().receive()); info!("New messages: {:#?}", client.borrow_mut().receive());
}) as Box<dyn FnMut()>); }) as Box<dyn Fn()>);
// Start non-blocking game loop // Start non-blocking game loop
setInterval(&f, 100); setInterval(&f, 100);
...@@ -38,5 +38,5 @@ fn main() -> Result<(), WebSocketError> { ...@@ -38,5 +38,5 @@ fn main() -> Result<(), WebSocketError> {
// Bind setInterval to make a basic game loop // Bind setInterval to make a basic game loop
#[wasm_bindgen] #[wasm_bindgen]
extern "C" { extern "C" {
fn setInterval(closure: &Closure<dyn FnMut()>, time: u32) -> i32; fn setInterval(closure: &Closure<dyn Fn()>, time: u32) -> i32;
} }
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
//! } //! }
//! // receive() gives you all new websocket messages since receive() was last called //! // receive() gives you all new websocket messages since receive() was last called
//! info!("New messages: {:#?}", client.borrow_mut().receive()); //! info!("New messages: {:#?}", client.borrow_mut().receive());
//! }) as Box<dyn FnMut()>); //! }) as Box<dyn Fn()>);
//! //!
//! // Start non-blocking game loop //! // Start non-blocking game loop
//! setInterval(&f, 100); //! setInterval(&f, 100);
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
//! // Bind setInterval to make a basic game loop //! // Bind setInterval to make a basic game loop
//! #[wasm_bindgen] //! #[wasm_bindgen]
//! extern "C" { //! extern "C" {
//! fn setInterval(closure: &Closure<dyn FnMut()>, time: u32) -> i32; //! fn setInterval(closure: &Closure<dyn Fn()>, time: u32) -> i32;
//! } //! }
//! ``` //! ```
#[cfg(test)] #[cfg(test)]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment