Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Wasm Sockets
Manage
Activity
Members
Labels
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Microhacks
Wasm Sockets
Commits
5c06f8e2
Unverified
Commit
5c06f8e2
authored
3 years ago
by
scratchyone
Browse files
Options
Downloads
Patches
Plain Diff
Update docs to use Fn instead of FnMut
parent
18590c26
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Readme.md
+2
-2
2 additions, 2 deletions
Readme.md
examples/polling.rs
+2
-2
2 additions, 2 deletions
examples/polling.rs
src/lib.rs
+2
-2
2 additions, 2 deletions
src/lib.rs
with
6 additions
and
6 deletions
Readme.md
+
2
−
2
View file @
5c06f8e2
...
@@ -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
Fn
Mut
()
>
);
})
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
Fn
Mut
()
>
,
time
:
u32
)
->
i32
;
fn
setInterval
(
closure
:
&
Closure
<
dyn
Fn
()
>
,
time
:
u32
)
->
i32
;
}
}
```
```
This diff is collapsed.
Click to expand it.
examples/polling.rs
+
2
−
2
View file @
5c06f8e2
...
@@ -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
Fn
Mut
()
>
);
})
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
Fn
Mut
()
>
,
time
:
u32
)
->
i32
;
fn
setInterval
(
closure
:
&
Closure
<
dyn
Fn
()
>
,
time
:
u32
)
->
i32
;
}
}
This diff is collapsed.
Click to expand it.
src/lib.rs
+
2
−
2
View file @
5c06f8e2
...
@@ -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 Fn
Mut
()>);
//! }) 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 Fn
Mut
()>, time: u32) -> i32;
//! fn setInterval(closure: &Closure<dyn Fn()>, time: u32) -> i32;
//! }
//! }
//! ```
//! ```
#[cfg(test)]
#[cfg(test)]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment