-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add further CI tools
- Loading branch information
Showing
16 changed files
with
350 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
/// This wrapper function encapsules our internal serialization format. | ||
/// It is used internally to prepare values before sending them to a worker | ||
/// or back to the main thread via `postMessage`. | ||
pub fn to_bytes<T: Serialize>(value: &T) -> Box<[u8]> { | ||
postcard::to_allocvec(value) | ||
.expect("WebWorker serialization failed") | ||
.into() | ||
} | ||
|
||
/// This wrapper function encapsules our internal serialization format. | ||
/// It is used internally to prepare values after receiving them from a worker | ||
/// or the main thread via `postMessage`. | ||
pub fn from_bytes<'de, T: Deserialize<'de>>(bytes: &'de [u8]) -> T { | ||
postcard::from_bytes(bytes).expect("WebWorker deserialization failed") | ||
} |
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,14 +1,23 @@ | ||
use js_sys::wasm_bindgen::JsValue; | ||
use thiserror::Error; | ||
|
||
/// This error is returned when a web worker has been configured with a | ||
/// maximum number of tasks to be queued and one of the `try_run` methods | ||
/// is called. | ||
#[derive(Debug, Error)] | ||
#[error("WebWorker capacity reached")] | ||
pub struct Full; | ||
|
||
/// This error is returned during the creation of a new web worker. | ||
/// It covers generic errors in the actual creation and import errors | ||
/// during the initialization. | ||
#[derive(Debug, Error)] | ||
pub enum InitError { | ||
/// This error covers errors during the `new Worker()` command. | ||
#[error("WebWorker creation error: {0:?}")] | ||
WebWorkerCreation(JsValue), | ||
/// This error signals that the [`crate::WebWorker`] has been initialized with | ||
/// an invalid path. The path should point to the glue file generated by wasm-bindgen. | ||
#[error("WebWorker module loading error: {0:?}")] | ||
WebWorkerModuleLoading(String), | ||
} |
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.