-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from MattiasBuelens/use-web-sys
Use web-sys for raw types
- Loading branch information
Showing
23 changed files
with
290 additions
and
432 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,38 @@ | ||
use js_sys::Object; | ||
use wasm_bindgen::prelude::*; | ||
|
||
#[wasm_bindgen] | ||
#[derive(Debug)] | ||
pub(crate) struct QueuingStrategy { | ||
high_water_mark: f64, | ||
extern "C" { | ||
#[wasm_bindgen(extends = Object, js_name = QueuingStrategy)] | ||
#[derive(Debug, Clone, PartialEq, Eq)] | ||
pub(crate) type QueuingStrategy; | ||
|
||
#[wasm_bindgen(method, getter, js_name = highWaterMark)] | ||
pub fn high_water_mark(this: &QueuingStrategy) -> f64; | ||
|
||
#[wasm_bindgen(method, setter, js_name = highWaterMark)] | ||
pub fn set_high_water_mark(this: &QueuingStrategy, value: f64); | ||
} | ||
|
||
impl QueuingStrategy { | ||
pub fn new(high_water_mark: f64) -> Self { | ||
Self { high_water_mark } | ||
let strategy = Object::new().unchecked_into::<QueuingStrategy>(); | ||
strategy.set_high_water_mark(high_water_mark); | ||
strategy | ||
} | ||
} | ||
|
||
#[wasm_bindgen] | ||
impl QueuingStrategy { | ||
#[wasm_bindgen(getter, js_name = highWaterMark)] | ||
pub fn high_water_mark(&self) -> f64 { | ||
self.high_water_mark | ||
#[cfg(web_sys_unstable_apis)] | ||
pub fn from_raw(raw: web_sys::QueuingStrategy) -> Self { | ||
raw.unchecked_into() | ||
} | ||
|
||
#[cfg(web_sys_unstable_apis)] | ||
pub fn as_raw(&self) -> &web_sys::QueuingStrategy { | ||
self.unchecked_ref() | ||
} | ||
|
||
#[cfg(web_sys_unstable_apis)] | ||
pub fn into_raw(self) -> web_sys::QueuingStrategy { | ||
self.unchecked_into() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.