diff --git a/Cargo.lock b/Cargo.lock index 9840a07..a0cfaf6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -152,7 +152,7 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "fetcher" -version = "0.0.0" +version = "0.1.0" dependencies = [ "fetcher-macros", "http", @@ -168,7 +168,7 @@ dependencies = [ [[package]] name = "fetcher-macros" -version = "0.0.0" +version = "0.1.0" dependencies = [ "fetcher", "proc-macro2", @@ -1343,7 +1343,7 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm" -version = "0.0.0" +version = "0.1.0" dependencies = [ "convert_case", "js-sys", diff --git a/fetcher-macros/Cargo.toml b/fetcher-macros/Cargo.toml index 6ff4944..4c4a48a 100644 --- a/fetcher-macros/Cargo.toml +++ b/fetcher-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fetcher-macros" -version = "0.0.0" +version = "0.1.0" edition = "2021" [dependencies] diff --git a/fetcher/Cargo.toml b/fetcher/Cargo.toml index a5cdf45..f6559b4 100644 --- a/fetcher/Cargo.toml +++ b/fetcher/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fetcher" -version = "0.0.0" +version = "0.1.0" edition = "2021" [dependencies] diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index dbc5f3e..1d20f00 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wasm" -version = "0.0.0" +version = "0.1.0" edition = "2021" [dependencies] diff --git a/wasm/README.md b/wasm/README.md index c1adf6d..fcb2648 100644 --- a/wasm/README.md +++ b/wasm/README.md @@ -7,37 +7,4 @@ wasm = { git = "https://github.com/LiterateInk/Utilities" } wasm-bindgen = "0.2" # required for the `wasm_bindgen::prelude::wasm_bindgen` macro js-sys = "0.3" # required for the `js_sys::Function` type -wee_alloc = "0.4" # required when using `setup_allocator!()` -``` - -## Usage - -### `setup_allocator` - -```rust -#[cfg(target_arch = "wasm32")] -wasm::setup_allocator!(); -``` - -Will use the `wee_alloc` crate to set up a global allocator for the `wasm32` target. - -### `api_method` - -A `fetcher` parameter is automatically added to the function signature. -See the [`fetcher` module](../fetcher) for more information. - -```rust -// the method will be called `fetchGitHub` in the generated bindings -#[cfg_attr(target_arch = "wasm32", wasm::api_method(fetchGitHub))] -pub async fn fetch_github(something: String) -> String { - // a `fetcher` variable is available - // if the target architecture is `wasm32` -} - -// the method will stille be called `update` in the generated bindings -#[cfg_attr(target_arch = "wasm32", wasm::api_method)] -pub async fn update(something: String) -> String { - // a `fetcher` variable is available - // if the target architecture is `wasm32` -} ``` diff --git a/wasm/src/lib.rs b/wasm/src/lib.rs index acafe29..7fe94b2 100644 --- a/wasm/src/lib.rs +++ b/wasm/src/lib.rs @@ -173,18 +173,6 @@ pub fn append_fetcher(_args: TokenStream, input: TokenStream) -> TokenStream { TokenStream::from(output) } -#[proc_macro] -pub fn setup_allocator(_input: TokenStream) -> TokenStream { - let expanded = quote! { - extern crate wee_alloc; - - #[global_allocator] - static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; - }; - - TokenStream::from(expanded) -} - #[proc_macro_derive(Error)] pub fn derive_wasm_error(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as DeriveInput);