pub struct Val { /* private fields */ }Implementations§
Source§impl Val
impl Val
Sourcepub fn from_handle(handle: u32) -> Val
pub fn from_handle(handle: u32) -> Val
Examples found in repository?
examples/dom.rs (line 15)
3fn main() {
4 let document = Val::global("document");
5 let elem = document.call("createElement", &argv!["BUTTON"]);
6 elem.set(&"textContent", Val::from("Click"));
7 let body = document.call("getElementsByTagName", &argv!["body"]).at(0);
8 elem.call(
9 "addEventListener",
10 &argv![
11 "click",
12 Val::make_js_function(|ev| {
13 let console = Val::global("console");
14 console.call("clear", &[]);
15 println!("client x: {}", Val::from_handle(ev).get("clientX").as_i32());
16 println!("hello from Rust");
17 Val::undefined().as_handle()
18 })
19 ],
20 );
21 body.call("appendChild", &argv![elem]);
22}pub fn from_val(v: Val) -> Self
Sourcepub fn global_this() -> Val
pub fn global_this() -> Val
Examples found in repository?
examples/audio.rs (line 19)
3fn main() {
4 #[allow(non_snake_case)]
5 let mut AudioContext = Val::global("AudioContext");
6 if !AudioContext.as_bool() {
7 println!("No global AudioContext, trying webkitAudioContext");
8 AudioContext = Val::global("webkitAudioContext");
9 }
10
11 println!("Got an AudioContext");
12 let context = AudioContext.new(&[]);
13 let oscillator = context.call("createOscillator", &[]);
14
15 println!("Configuring oscillator");
16 oscillator.set("type", Val::from("triangle"));
17 oscillator.get("frequency").set("value", Val::from(261.63)); // Middle C
18
19 Val::global_this().set("oscillator", oscillator);
20 Val::global_this().set("context", context);
21
22 let document = Val::global("document");
23 let elem = document.call("createElement", &argv!["BUTTON"]);
24 elem.set(&"textContent", Val::from("Click"));
25 let body = document.call("getElementsByTagName", &argv!["body"]).at(0);
26 elem.call(
27 "addEventListener",
28 &argv![
29 "click",
30 Val::make_js_function(|_| {
31 let oscillator = Val::global("oscillator");
32 let context = Val::global("context");
33 println!("Playing");
34 oscillator.call("connect", &argv![context.get("destination")]);
35 oscillator.call("start", &argv![0]);
36 println!("All done!");
37 Val::undefined().as_handle()
38 })
39 ],
40 );
41 body.call("appendChild", &argv![elem]);
42}Sourcepub fn get(&self, prop: &str) -> Val
pub fn get(&self, prop: &str) -> Val
Examples found in repository?
examples/dom.rs (line 15)
3fn main() {
4 let document = Val::global("document");
5 let elem = document.call("createElement", &argv!["BUTTON"]);
6 elem.set(&"textContent", Val::from("Click"));
7 let body = document.call("getElementsByTagName", &argv!["body"]).at(0);
8 elem.call(
9 "addEventListener",
10 &argv![
11 "click",
12 Val::make_js_function(|ev| {
13 let console = Val::global("console");
14 console.call("clear", &[]);
15 println!("client x: {}", Val::from_handle(ev).get("clientX").as_i32());
16 println!("hello from Rust");
17 Val::undefined().as_handle()
18 })
19 ],
20 );
21 body.call("appendChild", &argv![elem]);
22}More examples
examples/audio.rs (line 17)
3fn main() {
4 #[allow(non_snake_case)]
5 let mut AudioContext = Val::global("AudioContext");
6 if !AudioContext.as_bool() {
7 println!("No global AudioContext, trying webkitAudioContext");
8 AudioContext = Val::global("webkitAudioContext");
9 }
10
11 println!("Got an AudioContext");
12 let context = AudioContext.new(&[]);
13 let oscillator = context.call("createOscillator", &[]);
14
15 println!("Configuring oscillator");
16 oscillator.set("type", Val::from("triangle"));
17 oscillator.get("frequency").set("value", Val::from(261.63)); // Middle C
18
19 Val::global_this().set("oscillator", oscillator);
20 Val::global_this().set("context", context);
21
22 let document = Val::global("document");
23 let elem = document.call("createElement", &argv!["BUTTON"]);
24 elem.set(&"textContent", Val::from("Click"));
25 let body = document.call("getElementsByTagName", &argv!["body"]).at(0);
26 elem.call(
27 "addEventListener",
28 &argv![
29 "click",
30 Val::make_js_function(|_| {
31 let oscillator = Val::global("oscillator");
32 let context = Val::global("context");
33 println!("Playing");
34 oscillator.call("connect", &argv![context.get("destination")]);
35 oscillator.call("start", &argv![0]);
36 println!("All done!");
37 Val::undefined().as_handle()
38 })
39 ],
40 );
41 body.call("appendChild", &argv![elem]);
42}Sourcepub fn global(name: &str) -> Val
pub fn global(name: &str) -> Val
Examples found in repository?
examples/dom.rs (line 4)
3fn main() {
4 let document = Val::global("document");
5 let elem = document.call("createElement", &argv!["BUTTON"]);
6 elem.set(&"textContent", Val::from("Click"));
7 let body = document.call("getElementsByTagName", &argv!["body"]).at(0);
8 elem.call(
9 "addEventListener",
10 &argv![
11 "click",
12 Val::make_js_function(|ev| {
13 let console = Val::global("console");
14 console.call("clear", &[]);
15 println!("client x: {}", Val::from_handle(ev).get("clientX").as_i32());
16 println!("hello from Rust");
17 Val::undefined().as_handle()
18 })
19 ],
20 );
21 body.call("appendChild", &argv![elem]);
22}More examples
examples/audio.rs (line 5)
3fn main() {
4 #[allow(non_snake_case)]
5 let mut AudioContext = Val::global("AudioContext");
6 if !AudioContext.as_bool() {
7 println!("No global AudioContext, trying webkitAudioContext");
8 AudioContext = Val::global("webkitAudioContext");
9 }
10
11 println!("Got an AudioContext");
12 let context = AudioContext.new(&[]);
13 let oscillator = context.call("createOscillator", &[]);
14
15 println!("Configuring oscillator");
16 oscillator.set("type", Val::from("triangle"));
17 oscillator.get("frequency").set("value", Val::from(261.63)); // Middle C
18
19 Val::global_this().set("oscillator", oscillator);
20 Val::global_this().set("context", context);
21
22 let document = Val::global("document");
23 let elem = document.call("createElement", &argv!["BUTTON"]);
24 elem.set(&"textContent", Val::from("Click"));
25 let body = document.call("getElementsByTagName", &argv!["body"]).at(0);
26 elem.call(
27 "addEventListener",
28 &argv![
29 "click",
30 Val::make_js_function(|_| {
31 let oscillator = Val::global("oscillator");
32 let context = Val::global("context");
33 println!("Playing");
34 oscillator.call("connect", &argv![context.get("destination")]);
35 oscillator.call("start", &argv![0]);
36 println!("All done!");
37 Val::undefined().as_handle()
38 })
39 ],
40 );
41 body.call("appendChild", &argv![elem]);
42}pub fn null() -> Val
Sourcepub fn undefined() -> Val
pub fn undefined() -> Val
Examples found in repository?
examples/dom.rs (line 17)
3fn main() {
4 let document = Val::global("document");
5 let elem = document.call("createElement", &argv!["BUTTON"]);
6 elem.set(&"textContent", Val::from("Click"));
7 let body = document.call("getElementsByTagName", &argv!["body"]).at(0);
8 elem.call(
9 "addEventListener",
10 &argv![
11 "click",
12 Val::make_js_function(|ev| {
13 let console = Val::global("console");
14 console.call("clear", &[]);
15 println!("client x: {}", Val::from_handle(ev).get("clientX").as_i32());
16 println!("hello from Rust");
17 Val::undefined().as_handle()
18 })
19 ],
20 );
21 body.call("appendChild", &argv![elem]);
22}More examples
examples/audio.rs (line 37)
3fn main() {
4 #[allow(non_snake_case)]
5 let mut AudioContext = Val::global("AudioContext");
6 if !AudioContext.as_bool() {
7 println!("No global AudioContext, trying webkitAudioContext");
8 AudioContext = Val::global("webkitAudioContext");
9 }
10
11 println!("Got an AudioContext");
12 let context = AudioContext.new(&[]);
13 let oscillator = context.call("createOscillator", &[]);
14
15 println!("Configuring oscillator");
16 oscillator.set("type", Val::from("triangle"));
17 oscillator.get("frequency").set("value", Val::from(261.63)); // Middle C
18
19 Val::global_this().set("oscillator", oscillator);
20 Val::global_this().set("context", context);
21
22 let document = Val::global("document");
23 let elem = document.call("createElement", &argv!["BUTTON"]);
24 elem.set(&"textContent", Val::from("Click"));
25 let body = document.call("getElementsByTagName", &argv!["body"]).at(0);
26 elem.call(
27 "addEventListener",
28 &argv![
29 "click",
30 Val::make_js_function(|_| {
31 let oscillator = Val::global("oscillator");
32 let context = Val::global("context");
33 println!("Playing");
34 oscillator.call("connect", &argv![context.get("destination")]);
35 oscillator.call("start", &argv![0]);
36 println!("All done!");
37 Val::undefined().as_handle()
38 })
39 ],
40 );
41 body.call("appendChild", &argv![elem]);
42}pub fn object() -> Val
pub fn array() -> Val
pub fn from_i32(i: i32) -> Val
pub fn from_f64(f: f64) -> Val
pub fn from_str(s: &str) -> Val
Sourcepub fn as_handle(&self) -> u32
pub fn as_handle(&self) -> u32
Examples found in repository?
examples/dom.rs (line 17)
3fn main() {
4 let document = Val::global("document");
5 let elem = document.call("createElement", &argv!["BUTTON"]);
6 elem.set(&"textContent", Val::from("Click"));
7 let body = document.call("getElementsByTagName", &argv!["body"]).at(0);
8 elem.call(
9 "addEventListener",
10 &argv![
11 "click",
12 Val::make_js_function(|ev| {
13 let console = Val::global("console");
14 console.call("clear", &[]);
15 println!("client x: {}", Val::from_handle(ev).get("clientX").as_i32());
16 println!("hello from Rust");
17 Val::undefined().as_handle()
18 })
19 ],
20 );
21 body.call("appendChild", &argv![elem]);
22}More examples
examples/audio.rs (line 37)
3fn main() {
4 #[allow(non_snake_case)]
5 let mut AudioContext = Val::global("AudioContext");
6 if !AudioContext.as_bool() {
7 println!("No global AudioContext, trying webkitAudioContext");
8 AudioContext = Val::global("webkitAudioContext");
9 }
10
11 println!("Got an AudioContext");
12 let context = AudioContext.new(&[]);
13 let oscillator = context.call("createOscillator", &[]);
14
15 println!("Configuring oscillator");
16 oscillator.set("type", Val::from("triangle"));
17 oscillator.get("frequency").set("value", Val::from(261.63)); // Middle C
18
19 Val::global_this().set("oscillator", oscillator);
20 Val::global_this().set("context", context);
21
22 let document = Val::global("document");
23 let elem = document.call("createElement", &argv!["BUTTON"]);
24 elem.set(&"textContent", Val::from("Click"));
25 let body = document.call("getElementsByTagName", &argv!["body"]).at(0);
26 elem.call(
27 "addEventListener",
28 &argv![
29 "click",
30 Val::make_js_function(|_| {
31 let oscillator = Val::global("oscillator");
32 let context = Val::global("context");
33 println!("Playing");
34 oscillator.call("connect", &argv![context.get("destination")]);
35 oscillator.call("start", &argv![0]);
36 println!("All done!");
37 Val::undefined().as_handle()
38 })
39 ],
40 );
41 body.call("appendChild", &argv![elem]);
42}Sourcepub fn set(&self, prop: &str, val: Val)
pub fn set(&self, prop: &str, val: Val)
Examples found in repository?
examples/dom.rs (line 6)
3fn main() {
4 let document = Val::global("document");
5 let elem = document.call("createElement", &argv!["BUTTON"]);
6 elem.set(&"textContent", Val::from("Click"));
7 let body = document.call("getElementsByTagName", &argv!["body"]).at(0);
8 elem.call(
9 "addEventListener",
10 &argv![
11 "click",
12 Val::make_js_function(|ev| {
13 let console = Val::global("console");
14 console.call("clear", &[]);
15 println!("client x: {}", Val::from_handle(ev).get("clientX").as_i32());
16 println!("hello from Rust");
17 Val::undefined().as_handle()
18 })
19 ],
20 );
21 body.call("appendChild", &argv![elem]);
22}More examples
examples/audio.rs (line 16)
3fn main() {
4 #[allow(non_snake_case)]
5 let mut AudioContext = Val::global("AudioContext");
6 if !AudioContext.as_bool() {
7 println!("No global AudioContext, trying webkitAudioContext");
8 AudioContext = Val::global("webkitAudioContext");
9 }
10
11 println!("Got an AudioContext");
12 let context = AudioContext.new(&[]);
13 let oscillator = context.call("createOscillator", &[]);
14
15 println!("Configuring oscillator");
16 oscillator.set("type", Val::from("triangle"));
17 oscillator.get("frequency").set("value", Val::from(261.63)); // Middle C
18
19 Val::global_this().set("oscillator", oscillator);
20 Val::global_this().set("context", context);
21
22 let document = Val::global("document");
23 let elem = document.call("createElement", &argv!["BUTTON"]);
24 elem.set(&"textContent", Val::from("Click"));
25 let body = document.call("getElementsByTagName", &argv!["body"]).at(0);
26 elem.call(
27 "addEventListener",
28 &argv![
29 "click",
30 Val::make_js_function(|_| {
31 let oscillator = Val::global("oscillator");
32 let context = Val::global("context");
33 println!("Playing");
34 oscillator.call("connect", &argv![context.get("destination")]);
35 oscillator.call("start", &argv![0]);
36 println!("All done!");
37 Val::undefined().as_handle()
38 })
39 ],
40 );
41 body.call("appendChild", &argv![elem]);
42}pub fn has(&self, prop: &str) -> bool
pub fn has_own_property(&self, prop: &str) -> bool
pub fn type_of(&self) -> String
Sourcepub fn at(&self, idx: usize) -> Val
pub fn at(&self, idx: usize) -> Val
Examples found in repository?
examples/dom.rs (line 7)
3fn main() {
4 let document = Val::global("document");
5 let elem = document.call("createElement", &argv!["BUTTON"]);
6 elem.set(&"textContent", Val::from("Click"));
7 let body = document.call("getElementsByTagName", &argv!["body"]).at(0);
8 elem.call(
9 "addEventListener",
10 &argv![
11 "click",
12 Val::make_js_function(|ev| {
13 let console = Val::global("console");
14 console.call("clear", &[]);
15 println!("client x: {}", Val::from_handle(ev).get("clientX").as_i32());
16 println!("hello from Rust");
17 Val::undefined().as_handle()
18 })
19 ],
20 );
21 body.call("appendChild", &argv![elem]);
22}More examples
examples/audio.rs (line 25)
3fn main() {
4 #[allow(non_snake_case)]
5 let mut AudioContext = Val::global("AudioContext");
6 if !AudioContext.as_bool() {
7 println!("No global AudioContext, trying webkitAudioContext");
8 AudioContext = Val::global("webkitAudioContext");
9 }
10
11 println!("Got an AudioContext");
12 let context = AudioContext.new(&[]);
13 let oscillator = context.call("createOscillator", &[]);
14
15 println!("Configuring oscillator");
16 oscillator.set("type", Val::from("triangle"));
17 oscillator.get("frequency").set("value", Val::from(261.63)); // Middle C
18
19 Val::global_this().set("oscillator", oscillator);
20 Val::global_this().set("context", context);
21
22 let document = Val::global("document");
23 let elem = document.call("createElement", &argv!["BUTTON"]);
24 elem.set(&"textContent", Val::from("Click"));
25 let body = document.call("getElementsByTagName", &argv!["body"]).at(0);
26 elem.call(
27 "addEventListener",
28 &argv![
29 "click",
30 Val::make_js_function(|_| {
31 let oscillator = Val::global("oscillator");
32 let context = Val::global("context");
33 println!("Playing");
34 oscillator.call("connect", &argv![context.get("destination")]);
35 oscillator.call("start", &argv![0]);
36 println!("All done!");
37 Val::undefined().as_handle()
38 })
39 ],
40 );
41 body.call("appendChild", &argv![elem]);
42}Sourcepub fn as_i32(&self) -> i32
pub fn as_i32(&self) -> i32
Examples found in repository?
examples/dom.rs (line 15)
3fn main() {
4 let document = Val::global("document");
5 let elem = document.call("createElement", &argv!["BUTTON"]);
6 elem.set(&"textContent", Val::from("Click"));
7 let body = document.call("getElementsByTagName", &argv!["body"]).at(0);
8 elem.call(
9 "addEventListener",
10 &argv![
11 "click",
12 Val::make_js_function(|ev| {
13 let console = Val::global("console");
14 console.call("clear", &[]);
15 println!("client x: {}", Val::from_handle(ev).get("clientX").as_i32());
16 println!("hello from Rust");
17 Val::undefined().as_handle()
18 })
19 ],
20 );
21 body.call("appendChild", &argv![elem]);
22}Sourcepub fn as_bool(&self) -> bool
pub fn as_bool(&self) -> bool
Examples found in repository?
examples/audio.rs (line 6)
3fn main() {
4 #[allow(non_snake_case)]
5 let mut AudioContext = Val::global("AudioContext");
6 if !AudioContext.as_bool() {
7 println!("No global AudioContext, trying webkitAudioContext");
8 AudioContext = Val::global("webkitAudioContext");
9 }
10
11 println!("Got an AudioContext");
12 let context = AudioContext.new(&[]);
13 let oscillator = context.call("createOscillator", &[]);
14
15 println!("Configuring oscillator");
16 oscillator.set("type", Val::from("triangle"));
17 oscillator.get("frequency").set("value", Val::from(261.63)); // Middle C
18
19 Val::global_this().set("oscillator", oscillator);
20 Val::global_this().set("context", context);
21
22 let document = Val::global("document");
23 let elem = document.call("createElement", &argv!["BUTTON"]);
24 elem.set(&"textContent", Val::from("Click"));
25 let body = document.call("getElementsByTagName", &argv!["body"]).at(0);
26 elem.call(
27 "addEventListener",
28 &argv![
29 "click",
30 Val::make_js_function(|_| {
31 let oscillator = Val::global("oscillator");
32 let context = Val::global("context");
33 println!("Playing");
34 oscillator.call("connect", &argv![context.get("destination")]);
35 oscillator.call("start", &argv![0]);
36 println!("All done!");
37 Val::undefined().as_handle()
38 })
39 ],
40 );
41 body.call("appendChild", &argv![elem]);
42}pub fn as_f64(&self) -> f64
pub fn as_string(&self) -> String
pub fn to_vec_i32(&self) -> Vec<i32>
pub fn to_vec_f64(&self) -> Vec<f64>
Sourcepub fn call(&self, f: &str, args: &[Val]) -> Val
pub fn call(&self, f: &str, args: &[Val]) -> Val
Examples found in repository?
examples/dom.rs (line 5)
3fn main() {
4 let document = Val::global("document");
5 let elem = document.call("createElement", &argv!["BUTTON"]);
6 elem.set(&"textContent", Val::from("Click"));
7 let body = document.call("getElementsByTagName", &argv!["body"]).at(0);
8 elem.call(
9 "addEventListener",
10 &argv![
11 "click",
12 Val::make_js_function(|ev| {
13 let console = Val::global("console");
14 console.call("clear", &[]);
15 println!("client x: {}", Val::from_handle(ev).get("clientX").as_i32());
16 println!("hello from Rust");
17 Val::undefined().as_handle()
18 })
19 ],
20 );
21 body.call("appendChild", &argv![elem]);
22}More examples
examples/audio.rs (line 13)
3fn main() {
4 #[allow(non_snake_case)]
5 let mut AudioContext = Val::global("AudioContext");
6 if !AudioContext.as_bool() {
7 println!("No global AudioContext, trying webkitAudioContext");
8 AudioContext = Val::global("webkitAudioContext");
9 }
10
11 println!("Got an AudioContext");
12 let context = AudioContext.new(&[]);
13 let oscillator = context.call("createOscillator", &[]);
14
15 println!("Configuring oscillator");
16 oscillator.set("type", Val::from("triangle"));
17 oscillator.get("frequency").set("value", Val::from(261.63)); // Middle C
18
19 Val::global_this().set("oscillator", oscillator);
20 Val::global_this().set("context", context);
21
22 let document = Val::global("document");
23 let elem = document.call("createElement", &argv!["BUTTON"]);
24 elem.set(&"textContent", Val::from("Click"));
25 let body = document.call("getElementsByTagName", &argv!["body"]).at(0);
26 elem.call(
27 "addEventListener",
28 &argv![
29 "click",
30 Val::make_js_function(|_| {
31 let oscillator = Val::global("oscillator");
32 let context = Val::global("context");
33 println!("Playing");
34 oscillator.call("connect", &argv![context.get("destination")]);
35 oscillator.call("start", &argv![0]);
36 println!("All done!");
37 Val::undefined().as_handle()
38 })
39 ],
40 );
41 body.call("appendChild", &argv![elem]);
42}Sourcepub fn new(&self, args: &[Val]) -> Val
pub fn new(&self, args: &[Val]) -> Val
Examples found in repository?
examples/audio.rs (line 12)
3fn main() {
4 #[allow(non_snake_case)]
5 let mut AudioContext = Val::global("AudioContext");
6 if !AudioContext.as_bool() {
7 println!("No global AudioContext, trying webkitAudioContext");
8 AudioContext = Val::global("webkitAudioContext");
9 }
10
11 println!("Got an AudioContext");
12 let context = AudioContext.new(&[]);
13 let oscillator = context.call("createOscillator", &[]);
14
15 println!("Configuring oscillator");
16 oscillator.set("type", Val::from("triangle"));
17 oscillator.get("frequency").set("value", Val::from(261.63)); // Middle C
18
19 Val::global_this().set("oscillator", oscillator);
20 Val::global_this().set("context", context);
21
22 let document = Val::global("document");
23 let elem = document.call("createElement", &argv!["BUTTON"]);
24 elem.set(&"textContent", Val::from("Click"));
25 let body = document.call("getElementsByTagName", &argv!["body"]).at(0);
26 elem.call(
27 "addEventListener",
28 &argv![
29 "click",
30 Val::make_js_function(|_| {
31 let oscillator = Val::global("oscillator");
32 let context = Val::global("context");
33 println!("Playing");
34 oscillator.call("connect", &argv![context.get("destination")]);
35 oscillator.call("start", &argv![0]);
36 println!("All done!");
37 Val::undefined().as_handle()
38 })
39 ],
40 );
41 body.call("appendChild", &argv![elem]);
42}pub fn invoke(&self, args: &[Val]) -> Val
Sourcepub fn make_js_function(f: fn(u32) -> u32) -> Val
pub fn make_js_function(f: fn(u32) -> u32) -> Val
Examples found in repository?
examples/dom.rs (lines 12-18)
3fn main() {
4 let document = Val::global("document");
5 let elem = document.call("createElement", &argv!["BUTTON"]);
6 elem.set(&"textContent", Val::from("Click"));
7 let body = document.call("getElementsByTagName", &argv!["body"]).at(0);
8 elem.call(
9 "addEventListener",
10 &argv![
11 "click",
12 Val::make_js_function(|ev| {
13 let console = Val::global("console");
14 console.call("clear", &[]);
15 println!("client x: {}", Val::from_handle(ev).get("clientX").as_i32());
16 println!("hello from Rust");
17 Val::undefined().as_handle()
18 })
19 ],
20 );
21 body.call("appendChild", &argv![elem]);
22}More examples
examples/audio.rs (lines 30-38)
3fn main() {
4 #[allow(non_snake_case)]
5 let mut AudioContext = Val::global("AudioContext");
6 if !AudioContext.as_bool() {
7 println!("No global AudioContext, trying webkitAudioContext");
8 AudioContext = Val::global("webkitAudioContext");
9 }
10
11 println!("Got an AudioContext");
12 let context = AudioContext.new(&[]);
13 let oscillator = context.call("createOscillator", &[]);
14
15 println!("Configuring oscillator");
16 oscillator.set("type", Val::from("triangle"));
17 oscillator.get("frequency").set("value", Val::from(261.63)); // Middle C
18
19 Val::global_this().set("oscillator", oscillator);
20 Val::global_this().set("context", context);
21
22 let document = Val::global("document");
23 let elem = document.call("createElement", &argv!["BUTTON"]);
24 elem.set(&"textContent", Val::from("Click"));
25 let body = document.call("getElementsByTagName", &argv!["body"]).at(0);
26 elem.call(
27 "addEventListener",
28 &argv![
29 "click",
30 Val::make_js_function(|_| {
31 let oscillator = Val::global("oscillator");
32 let context = Val::global("context");
33 println!("Playing");
34 oscillator.call("connect", &argv![context.get("destination")]);
35 oscillator.call("start", &argv![0]);
36 println!("All done!");
37 Val::undefined().as_handle()
38 })
39 ],
40 );
41 body.call("appendChild", &argv![elem]);
42}pub fn await_(&self) -> Val
pub fn delete(v: Val)
pub fn throw(v: Val)
pub fn instanceof(&self, v: Val) -> bool
Trait Implementations§
Source§impl PartialOrd for Val
impl PartialOrd for Val
impl Copy for Val
Auto Trait Implementations§
impl Freeze for Val
impl RefUnwindSafe for Val
impl Send for Val
impl Sync for Val
impl Unpin for Val
impl UnwindSafe for Val
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more