repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/targets.rs | crates/cli/tests/reference/targets.rs | // FLAGS: --target=bundler
// FLAGS: --target=web
// FLAGS: --target=no-modules
// FLAGS: --target=nodejs
// FLAGS: --target=deno
// FLAGS: --target=module
// FLAGS: --target=module --experimental-reset-state-function
// FLAGS: --target=experimental-nodejs-module
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/intrinsic-only.rs | crates/cli/tests/reference/intrinsic-only.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn causes_error() -> Result<f64, JsError> {
Ok(1.0)
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/anyref-empty.rs | crates/cli/tests/reference/anyref-empty.rs | // enable-externref
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/modules.rs | crates/cli/tests/reference/modules.rs | use wasm_bindgen::prelude::*;
mod a {
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_name = parseFloat)]
pub fn parse_float(text: &JsValue) -> f64;
}
}
mod b {
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/empty.rs | crates/cli/tests/reference/empty.rs | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false | |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/wasm-export-colon.rs | crates/cli/tests/reference/wasm-export-colon.rs | // FLAGS: --target=web
// DEPENDENCY: wasm-bindgen-test = { path = '{root}/crates/test' }
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
// This test ensures that identifiers containing colons (like `__wbgt__reference_test::colon_test`)
// are properly quoted in the generated .d.ts file, since colons are not... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/custom-section.rs | crates/cli/tests/reference/custom-section.rs | use wasm_bindgen::prelude::*;
// Test that custom TypeScript sections are sorted alphabetically
// Define them in non-alphabetical order
#[wasm_bindgen(typescript_custom_section)]
const TS_ZEBRA: &'static str = r#"export type ZebraType = "stripes";"#;
#[wasm_bindgen(typescript_custom_section)]
const TS_APPLE: &'stat... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/reexport.rs | crates/cli/tests/reference/reexport.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen(js_namespace = Snippet)]
pub fn foo() {}
#[wasm_bindgen(module = "some-library")]
extern "C" {
#[wasm_bindgen(js_name = "OriginalName", reexport = "RenamedClass")]
pub type MyClass;
}
#[wasm_bindgen(module = "default-export-lib")]
extern "C" {
#[wasm_bindgen(j... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/optional-args.rs | crates/cli/tests/reference/optional-args.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn all_optional(a: Option<u32>, b: Option<u32>, c: Option<u32>) {}
#[wasm_bindgen]
pub fn some_optional(a: Option<u32>, b: u32, c: Option<u32>) {}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/typescript-type.rs | crates/cli/tests/reference/typescript-type.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(typescript_type = "number | string")]
type CustomType;
}
#[wasm_bindgen]
pub fn single(a: CustomType) {}
#[wasm_bindgen]
pub fn slice(a: Vec<CustomType>) {}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/static.rs | crates/cli/tests/reference/static.rs | // DEPENDENCY: js-sys = { path = '{root}/crates/js-sys' }
use js_sys::Number;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(thread_local_v2)]
static PLAIN: JsValue;
#[wasm_bindgen(thread_local_v2)]
static OPTIONAL: Option<Number>;
#[wasm_bindgen(thread_local_v2, js_name... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/closures.rs | crates/cli/tests/reference/closures.rs | // DEPENDENCY: js-sys = { path = '{root}/crates/js-sys' }
// DEPENDENCY: web-sys = { path = '{root}/crates/web-sys', features = ['console', 'Window'] }
use wasm_bindgen::prelude::*;
use web_sys::{console, window};
#[wasm_bindgen]
pub fn use_stack_callback(a: &js_sys::Array) {
a.for_each(&mut |v, _, _| {
c... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/keyword.rs | crates/cli/tests/reference/keyword.rs | use wasm_bindgen::prelude::*;
// Imports with keywords
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen]
pub type A;
#[wasm_bindgen(static_method_of = A, js_name = "new")]
pub fn static_new() -> A;
#[wasm_bindgen(js_namespace = ["B"], js_name = "new")]
pub fn namespace_new();
#[wasm_bindgen(m... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/enums.rs | crates/cli/tests/reference/enums.rs | use wasm_bindgen::prelude::*;
/// A color.
#[wasm_bindgen]
#[derive(PartialEq, Debug)]
pub enum Color {
/// Green as a leaf.
Green,
/// Yellow as the sun.
Yellow,
/// Red as a rose.
Red,
}
#[wasm_bindgen]
pub fn enum_echo(color: Color) -> Color {
color
}
#[wasm_bindgen]
pub fn option_enum... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/web-sys.rs | crates/cli/tests/reference/web-sys.rs | // DEPENDENCY: web-sys = { path = '{root}/crates/web-sys', features = ['console', 'Url', 'MediaSourceEnum', 'MediaSourceReadyState'] }
use wasm_bindgen::prelude::wasm_bindgen;
use web_sys::{MediaSourceEnum, MediaSourceReadyState, Url};
#[wasm_bindgen]
pub fn get_url() -> Url {
assert_eq!(MediaSourceReadyState::Cl... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/echo.rs | crates/cli/tests/reference/echo.rs | use std::mem::MaybeUninit;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub struct Foo {
x: u32,
}
macro_rules! echo {
($(($n:ident, $t:ty)),*) => {
$(
#[wasm_bindgen]
pub fn $n(a: $t) -> $t {
a
}
)*
}
}
echo!(
(echo_u8, u8),
(e... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/string-arg.rs | crates/cli/tests/reference/string-arg.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn foo(a: &str) {
drop(a);
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/result.rs | crates/cli/tests/reference/result.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn result_string() -> Result<String, JsValue> {
Err(JsValue::from(5i32))
}
#[wasm_bindgen]
pub fn result_void() -> Result<(), JsError> {
Err(JsError::new("message"))
}
#[wasm_bindgen]
pub fn result_i32() -> Result<i32, JsError> {
Ok(1)
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/import-getter-setter.rs | crates/cli/tests/reference/import-getter-setter.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_namespace = Bar, getter = bar)]
fn get_foo() -> u32;
#[wasm_bindgen(js_namespace = Bar, setter = bar)]
fn set_foo(value: u32);
#[wasm_bindgen(js_namespace = Bar, getter, js_name = bar2)]
fn get_foo2() -> u32;
#[was... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/constructor.rs | crates/cli/tests/reference/constructor.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub struct ClassConstructor(());
#[wasm_bindgen]
impl ClassConstructor {
#[wasm_bindgen(constructor)]
pub fn new() -> ClassConstructor {
ClassConstructor(())
}
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/raw.rs | crates/cli/tests/reference/raw.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn r#test1(r#test: u32) -> u32 {
r#test2();
r#test
}
#[wasm_bindgen]
pub struct r#Test;
#[wasm_bindgen]
impl r#Test {
pub fn r#test1(r#test: u32) -> Self {
Self
}
pub fn r#test2(&self, r#test: u32) {}
}
#[wasm_bindgen(module = "test")]
e... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/async-void.rs | crates/cli/tests/reference/async-void.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub async fn foo() {}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/int128.rs | crates/cli/tests/reference/int128.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn echo_i128(a: i128) -> i128 {
a
}
#[wasm_bindgen]
pub fn echo_u128(a: u128) -> u128 {
a
}
#[wasm_bindgen]
pub fn echo_option_i128(a: Option<i128>) -> Option<i128> {
a
}
#[wasm_bindgen]
pub fn echo_option_u128(a: Option<u128>) -> Option<u128> {
a
}
#... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/anyref-nop.rs | crates/cli/tests/reference/anyref-nop.rs | // enable-externref
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn foo() {}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/getter-setter.rs | crates/cli/tests/reference/getter-setter.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
struct Foo {
pub x: u32,
pub y: Option<u32>,
z: Option<u32>,
}
#[wasm_bindgen]
impl Foo {
#[wasm_bindgen(getter)]
pub fn z(&self) -> Option<u32> {
self.z
}
#[wasm_bindgen(setter)]
pub fn set_z(&mut self, z: Option<u32>) {
se... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/add.rs | crates/cli/tests/reference/add.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn add_u32(a: u32, b: u32) -> u32 {
a + b
}
#[wasm_bindgen]
pub fn add_i32(a: i32, b: i32) -> i32 {
a + b
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/import.rs | crates/cli/tests/reference/import.rs | // FLAGS: --target=bundler
// FLAGS: --target=web
// FLAGS: --target=nodejs
// FLAGS: --target=experimental-nodejs-module
// FLAGS: --target=deno
// FLAGS: --target=module
// FLAGS: --target=module --experimental-reset-state-function
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
// Both `catch_me` an... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/async-number.rs | crates/cli/tests/reference/async-number.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub async fn foo() -> u32 {
1
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/js-namespace-export.rs | crates/cli/tests/reference/js-namespace-export.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen(js_namespace = math)]
pub fn add(a: i32, b: i32) -> i32 {
a + b
}
#[wasm_bindgen(js_namespace = math)]
pub fn multiply(a: i32, b: i32) -> i32 {
a * b
}
#[wasm_bindgen(js_namespace = "default")]
pub fn concat(a: &str, b: &str) -> String {
format!("{}{}", a, b)
... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/private.rs | crates/cli/tests/reference/private.rs | use wasm_bindgen::prelude::*;
/// A hidden struct that is not exported but can be used as an argument type
#[wasm_bindgen(private)]
pub struct HiddenStruct {
pub value: i32,
}
/// A public struct that is exported
#[wasm_bindgen]
pub struct PublicStruct {
pub value: i32,
}
/// A hidden enum that is not export... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/wasm-export-types.rs | crates/cli/tests/reference/wasm-export-types.rs | // FLAGS: --target=web
use wasm_bindgen::prelude::*;
// This is for testing the type generation of the wasm-exported functions.
// Here, example should be exported as `(arg0: number, arg1: bigint, arg2: any, arg3: number, arg4: number) => [number, number]`.
// Notes: `arg2: any` is an external reference to a JS value... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/default-function.rs | crates/cli/tests/reference/default-function.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen(js_name = default)]
pub fn default_function(a: i32, b: i32) -> i32 {
a + b
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/cli/tests/reference/nop.rs | crates/cli/tests/reference/nop.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn nop() {}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/typescript-tests/src/custom_section.rs | crates/typescript-tests/src/custom_section.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen(typescript_custom_section)]
const TS_INTERFACE_EXPORT: &'static str = r"
interface Height { height: number; }
";
#[wasm_bindgen(typescript_custom_section)]
const TS_INTERFACE_EXPORT1: &'static str = include_str!("./custom_section_types.d.ts");
#[allow(dead_code)]
const ... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/typescript-tests/src/optional_fields.rs | crates/typescript-tests/src/optional_fields.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub struct Fields {
pub hallo: Option<bool>,
pub spaceboy: bool,
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/typescript-tests/src/web_sys.rs | crates/typescript-tests/src/web_sys.rs | use wasm_bindgen::prelude::*;
use web_sys::*;
#[wasm_bindgen]
pub struct DocStruct {
doc: Document,
}
#[wasm_bindgen]
impl DocStruct {
pub fn new(doc: Document) -> Self {
Self { doc }
}
pub fn get_doc(&self) -> Document {
self.doc.clone()
}
pub fn append_element(&self, elemen... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/typescript-tests/src/simple_async_fn.rs | crates/typescript-tests/src/simple_async_fn.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub async fn async_greet(_: String) {}
#[wasm_bindgen]
pub async fn async_take_and_return_bool(_: bool) -> bool {
true
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/typescript-tests/src/simple_struct.rs | crates/typescript-tests/src/simple_struct.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub struct A {}
#[wasm_bindgen]
impl A {
#[wasm_bindgen(constructor)]
pub fn new() -> A {
A {}
}
pub fn other() {}
pub fn foo(&self) {}
pub fn ret_bool(&self) -> bool {
true
}
pub fn take_bool(&self, _: bool) {}
pub f... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/typescript-tests/src/lib.rs | crates/typescript-tests/src/lib.rs | // > `disallowed_names` lint should not be triggered inside of the test code.
#![allow(clippy::disallowed_names)]
pub mod custom_section;
pub mod enums;
pub mod function_attrs;
pub mod getters_setters;
pub mod inspectable;
pub mod omit_definition;
pub mod opt_args_and_ret;
pub mod optional_fields;
pub mod simple_async... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/typescript-tests/src/typescript_type.rs | crates/typescript-tests/src/typescript_type.rs | use serde::{Deserialize, Serialize};
use wasm_bindgen::prelude::*;
#[wasm_bindgen(typescript_custom_section)]
const ITEXT_STYLE: &'static str = r#"
interface ITextStyle {
bold: boolean;
italic: boolean;
size: number;
}
"#;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(typescript_type = "ITextStyle")]
... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/typescript-tests/src/omit_definition.rs | crates/typescript-tests/src/omit_definition.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen(typescript_custom_section)]
const TYPE_GET_VALUE: &'static str =
"export function take_function(func: (x: number) => void): void;";
#[wasm_bindgen(skip_typescript)]
pub fn take_function(_: js_sys::Function) {}
#[wasm_bindgen]
pub struct MyExportedStruct {
#[wasm_b... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/typescript-tests/src/simple_fn.rs | crates/typescript-tests/src/simple_fn.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn greet(_: &str) {}
#[wasm_bindgen]
pub fn take_and_return_bool(_: bool) -> bool {
true
}
#[wasm_bindgen(variadic)]
pub fn variadic_function(arr: &JsValue) -> JsValue {
arr.into()
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/typescript-tests/src/enums.rs | crates/typescript-tests/src/enums.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub enum Foo {
A = 1,
B = 3,
}
#[wasm_bindgen]
pub fn fn_expects_enum(_: Foo) {}
#[wasm_bindgen]
pub fn fn_returns_enum() -> Foo {
Foo::A
}
#[wasm_bindgen]
pub fn fn_expects_option_enum(_: Option<Foo>) {}
#[wasm_bindgen]
pub fn fn_returns_option_enum() -> O... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/typescript-tests/src/opt_args_and_ret.rs | crates/typescript-tests/src/opt_args_and_ret.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
/// Optional parameters followed by non-optional parameters.
/// Only the parameter _c may be marked as omittable.
pub fn opt_fn_mixed(_a: Option<i32>, _b: i32, _c: Option<i32>) -> Option<i32> {
None
}
#[wasm_bindgen]
/// Only optional parameters. All of them may be m... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/typescript-tests/src/inspectable.rs | crates/typescript-tests/src/inspectable.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen(inspectable)]
pub struct Bar {
pub foo: i32,
_private: i32,
}
#[wasm_bindgen]
impl Bar {
#[wasm_bindgen(constructor)]
pub fn new(foo: i32) -> Self {
Self { foo, _private: 13 }
}
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/typescript-tests/src/function_attrs.rs | crates/typescript-tests/src/function_attrs.rs | use wasm_bindgen::prelude::*;
/// Description for fn_with_attr
#[wasm_bindgen(
unchecked_return_type = "number",
return_description = "returns 1 if arg2 is true, or arg1 if arg2 is undefined or false"
)]
pub async fn fn_with_attr(
#[wasm_bindgen(js_name = "firstArg", param_description = "some number")] arg... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/typescript-tests/src/getters_setters.rs | crates/typescript-tests/src/getters_setters.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub struct ColorWithGetters {
r: f64,
_g: f64,
_b: f64,
_a: u8,
}
#[wasm_bindgen]
impl ColorWithGetters {
#[wasm_bindgen(constructor)]
pub fn new() -> Self {
Self {
r: 0.0,
_g: 0.0,
_b: 0.0,
_... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/typescript-tests/src/usize.rs | crates/typescript-tests/src/usize.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn usize_identity(x: usize) -> usize {
x
}
#[wasm_bindgen]
pub fn isize_identity(x: isize) -> isize {
x
}
#[wasm_bindgen]
pub async fn async_usize_identity(x: usize) -> usize {
x
}
#[wasm_bindgen]
pub async fn async_isize_identity(x: isize) -> isize {
... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/shared/build.rs | crates/shared/build.rs | use std::collections::hash_map::DefaultHasher;
use std::env;
use std::hash::Hasher;
use std::path::PathBuf;
use std::process::Command;
fn main() {
set_schema_version_env_var();
let rev = Command::new("git")
.arg("rev-parse")
.arg("HEAD")
.output()
.ok()
.map(|s| s.stdou... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/shared/src/lib.rs | crates/shared/src/lib.rs | #![doc(html_root_url = "https://docs.rs/wasm-bindgen-shared/0.2")]
#![no_std]
extern crate alloc;
use alloc::string::{String, ToString};
pub mod identifier;
#[cfg(test)]
mod schema_hash_approval;
pub mod tys;
// This gets changed whenever our schema changes.
// At this time versions of wasm-bindgen and wasm-bindgen... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/shared/src/identifier.rs | crates/shared/src/identifier.rs | use alloc::string::String;
/// Returns whether a character is a valid JS identifier start character.
///
/// This is only ever-so-slightly different from `XID_Start` in a few edge
/// cases, so we handle those edge cases manually and delegate everything else
/// to `unicode-ident`.
fn is_id_start(c: char) -> bool {
... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/shared/src/tys.rs | crates/shared/src/tys.rs | macro_rules! tys {
($($a:ident)*) => (tys! { @ ($($a)*) 0 });
(@ () $v:expr) => {};
(@ ($a:ident $($b:ident)*) $v:expr) => {
pub const $a: u32 = $v;
tys!(@ ($($b)*) $v+1);
}
}
tys! {
I8
U8
I16
U16
I32
U32
I64
U64
I128
U128
F32
F64
BOOL... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/shared/src/schema_hash_approval.rs | crates/shared/src/schema_hash_approval.rs | // Whenever the lib.rs changes, the SCHEMA_FILE_HASH environment variable will change and the
// schema_version test below will fail.
// Proceed as follows:
//
// If the schema in this library has changed then:
// 1. Change this APPROVED_SCHEMA_FILE_HASH to the new hash.
//
// If the schema in this library has changed... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/webidl/src/lib.rs | crates/webidl/src/lib.rs | /*!
# `wasm_bindgen_webidl`
Converts WebIDL into wasm-bindgen's internal AST form, so that bindings can be
emitted for the types and methods described in the WebIDL.
*/
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![doc(html_root_url = "https://docs.rs/wasm-bindgen-webidl/0.2")]
mod constants;
mo... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | true |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/webidl/src/util.rs | crates/webidl/src/util.rs | use std::collections::{BTreeSet, HashSet};
use std::fs;
use std::iter::FromIterator;
use std::path::{Path, PathBuf};
use std::ptr;
use heck::{ToShoutySnakeCase, ToSnakeCase, ToUpperCamelCase};
use proc_macro2::{Ident, TokenStream};
use quote::quote;
use syn::punctuated::Punctuated;
use weedle::attribute::{
Extende... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | true |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/webidl/src/generator.rs | crates/webidl/src/generator.rs | use crate::util::{leading_colon_path_ty, raw_ident, rust_ident};
use proc_macro2::Literal;
use proc_macro2::TokenStream;
use quote::format_ident;
use quote::quote;
use std::collections::BTreeSet;
use syn::{Ident, Type};
use crate::constants::{BUILTIN_IDENTS, POLYFILL_INTERFACES};
use crate::idl_type::IdlType;
use crat... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/webidl/src/first_pass.rs | crates/webidl/src/first_pass.rs | //! Because some WebIDL constructs are defined in multiple places
//! (keyword `partial` is used to add to an existing construct),
//! We need to first walk the webidl to collect all non-partial
//! constructs so that we have containers in which to put the
//! partial ones.
//!
//! Only `interface`s, `dictionary`s, `en... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | true |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/webidl/src/traverse.rs | crates/webidl/src/traverse.rs | use syn::{Ident, Type};
pub trait TraverseType {
fn traverse_type<F>(&self, f: &mut F)
where
F: FnMut(&Ident);
}
impl TraverseType for Type {
fn traverse_type<F>(&self, f: &mut F)
where
F: FnMut(&Ident),
{
match self {
Type::Array(x) => x.traverse_type(f),
... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/webidl/src/update_cargo_toml.rs | crates/webidl/src/update_cargo_toml.rs | use anyhow::{Context, Result};
use std::{fs, path::PathBuf};
pub fn update_cargo_toml_features(
cargo_toml_path: &PathBuf,
generated_features: &str,
) -> Result<()> {
let mut cargo_toml_text = fs::read_to_string(cargo_toml_path).context("reading Cargo.toml")?;
let comment = "# This list is auto-generat... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/webidl/src/main.rs | crates/webidl/src/main.rs | mod update_cargo_toml;
use anyhow::Result;
use clap::Parser;
use std::path::PathBuf;
use update_cargo_toml::update_cargo_toml_features;
#[derive(Parser, Debug)]
#[clap(about = "Converts WebIDL into wasm-bindgen compatible code.")]
struct Opt {
input_dir: PathBuf,
output_dir: PathBuf,
#[clap(long)]
n... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/webidl/src/constants.rs | crates/webidl/src/constants.rs | use once_cell::sync::Lazy;
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::iter::FromIterator;
pub(crate) static BUILTIN_IDENTS: Lazy<BTreeSet<&'static str>> = Lazy::new(|| {
BTreeSet::from_iter(vec![
"str",
"char",
"bool",
"JsValue",
"u8",
"... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | true |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/crates/webidl/src/idl_type.rs | crates/webidl/src/idl_type.rs | use std::borrow::Cow;
use crate::util::{ident_ty, leading_colon_path_ty, raw_ident, rust_ident};
use proc_macro2::{Ident, Span};
use weedle::attribute::{ExtendedAttribute, ExtendedAttributeList};
use weedle::common::Identifier;
use weedle::term;
use weedle::types::*;
use crate::first_pass::FirstPassRecord;
use crate:... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | true |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/explicit-resource-management/src/lib.rs | examples/explicit-resource-management/src/lib.rs | use std::alloc::{GlobalAlloc, Layout, System};
use std::sync::atomic::{AtomicUsize, Ordering::Relaxed};
use wasm_bindgen::prelude::*;
// simple counting allocator tracking
struct Counter;
static ALLOCATED: AtomicUsize = AtomicUsize::new(0);
unsafe impl GlobalAlloc for Counter {
unsafe fn alloc(&self, layout: Lay... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/without-a-bundler-no-modules/src/lib.rs | examples/without-a-bundler-no-modules/src/lib.rs | use wasm_bindgen::prelude::*;
// Called when the Wasm module is instantiated
#[wasm_bindgen(start)]
fn main() -> Result<(), JsValue> {
// Use `web_sys`'s global `window` function to get a handle on the global
// window object.
let window = web_sys::window().expect("no global `window` exists");
let docu... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/closures/src/lib.rs | examples/closures/src/lib.rs | use js_sys::{Array, Date};
use wasm_bindgen::prelude::*;
use web_sys::{Document, Element, HtmlElement, Window};
#[wasm_bindgen(start)]
fn run() -> Result<(), JsValue> {
let window = web_sys::window().expect("should have a window in this context");
let document = window.document().expect("window should have a d... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/wasm-audio-worklet/src/lib.rs | examples/wasm-audio-worklet/src/lib.rs | mod gui;
mod oscillator;
mod wasm_audio;
use gui::create_gui;
use oscillator::{Oscillator, Params};
use wasm_audio::wasm_audio;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub async fn web_main() {
console_error_panic_hook::set_once();
// On the application level, audio worklet internals are abstracted by w... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/wasm-audio-worklet/src/wasm_audio.rs | examples/wasm-audio-worklet/src/wasm_audio.rs | use wasm_bindgen::prelude::*;
use wasm_bindgen::JsValue;
use wasm_bindgen_futures::JsFuture;
use web_sys::{AudioContext, AudioWorkletNode, AudioWorkletNodeOptions};
#[wasm_bindgen]
pub struct WasmAudioProcessor(Box<dyn FnMut(&mut [f32]) -> bool>);
#[wasm_bindgen]
impl WasmAudioProcessor {
pub fn process(&mut self... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/wasm-audio-worklet/src/gui.rs | examples/wasm-audio-worklet/src/gui.rs | use crate::oscillator::Params;
use wasm_bindgen::{closure::Closure, JsCast, JsValue};
use web_sys::{AudioContext, HtmlInputElement, HtmlLabelElement};
pub fn create_gui(params: &'static Params, ctx: AudioContext) {
let window = web_sys::window().unwrap();
let document = window.document().unwrap();
let body... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/wasm-audio-worklet/src/oscillator.rs | examples/wasm-audio-worklet/src/oscillator.rs | // Wasm audio processors can be implemented in Rust without knowing
// about audio worklets.
use std::sync::atomic::{AtomicU8, Ordering};
// Let's implement a simple sine oscillator with variable frequency and volume.
pub struct Oscillator {
params: &'static Params,
accumulator: u32,
}
impl Oscillator {
... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/request-animation-frame/src/lib.rs | examples/request-animation-frame/src/lib.rs | use std::cell::RefCell;
use std::rc::Rc;
use wasm_bindgen::prelude::*;
fn window() -> web_sys::Window {
web_sys::window().expect("no global `window` exists")
}
fn request_animation_frame(f: &Closure<dyn FnMut()>) {
window()
.request_animation_frame(f.as_ref().unchecked_ref())
.expect("should r... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/synchronous-instantiation/src/lib.rs | examples/synchronous-instantiation/src/lib.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_namespace = console)]
fn log(value: &str);
}
#[wasm_bindgen]
pub fn greet(name: &str) {
log(&format!("Hello, {name}!"));
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/wasm-in-wasm/src/lib.rs | examples/wasm-in-wasm/src/lib.rs | use js_sys::{Function, Object, Reflect, WebAssembly};
use wasm_bindgen::prelude::*;
use wasm_bindgen_futures::{spawn_local, JsFuture};
// lifted from the `console_log` example
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_namespace = console)]
fn log(a: &str);
}
macro_rules! console_log {
($($t:tt)*) => ... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/webxr/src/lib.rs | examples/webxr/src/lib.rs | #![cfg(web_sys_unstable_apis)]
#[macro_use]
mod utils;
use js_sys::{Object, Promise, Reflect};
use std::cell::RefCell;
use std::rc::Rc;
use utils::set_panic_hook;
use wasm_bindgen::prelude::*;
use wasm_bindgen_futures::future_to_promise;
use web_sys::*;
// A macro to provide `println!(..)`-style syntax for `console.... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/webxr/src/utils.rs | examples/webxr/src/utils.rs | pub fn set_panic_hook() {
// When the `console_error_panic_hook` feature is enabled, we can call the
// `set_panic_hook` function at least once during initialization, and then
// we will get better error messages if our code ever panics.
//
// For more details see
// https://github.com/rustwasm/... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/without-a-bundler/src/lib.rs | examples/without-a-bundler/src/lib.rs | use wasm_bindgen::prelude::*;
// Called when the Wasm module is instantiated
#[wasm_bindgen(start)]
fn main() -> Result<(), JsValue> {
// Use `web_sys`'s global `window` function to get a handle on the global
// window object.
let window = web_sys::window().expect("no global `window` exists");
let docu... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/guide-supported-types-examples/src/lib.rs | examples/guide-supported-types-examples/src/lib.rs | #![allow(unused_variables, dead_code, clippy::boxed_local)]
pub mod bool;
pub mod boxed_js_value_slice;
pub mod boxed_number_slices;
pub mod char;
pub mod exported_types;
pub mod imported_types;
pub mod js_value;
pub mod number_slices;
pub mod numbers;
pub mod pointers;
pub mod str;
pub mod string;
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/guide-supported-types-examples/src/js_value.rs | examples/guide-supported-types-examples/src/js_value.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn take_js_value_by_value(x: JsValue) {}
#[wasm_bindgen]
pub fn take_js_value_by_shared_ref(x: &JsValue) {}
#[wasm_bindgen]
pub fn return_js_value() -> JsValue {
JsValue::NULL
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/guide-supported-types-examples/src/pointers.rs | examples/guide-supported-types-examples/src/pointers.rs | use std::ptr;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn take_pointer_by_value(x: *mut u8) {}
#[wasm_bindgen]
pub fn return_pointer() -> *mut u8 {
ptr::null_mut()
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/guide-supported-types-examples/src/string.rs | examples/guide-supported-types-examples/src/string.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn take_string_by_value(x: String) {}
#[wasm_bindgen]
pub fn return_string() -> String {
"hello".into()
}
#[wasm_bindgen]
pub fn take_option_string(x: Option<String>) {}
#[wasm_bindgen]
pub fn return_option_string() -> Option<String> {
None
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/guide-supported-types-examples/src/exported_types.rs | examples/guide-supported-types-examples/src/exported_types.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub struct ExportedNamedStruct {
// pub value: String, // This won't work. See working example below.
pub inner: u32,
}
#[wasm_bindgen(getter_with_clone)]
pub struct ExportedNamedStructNonCopy {
pub non_copy_value: String,
pub copy_value: u32,
}
#[wasm_bi... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/guide-supported-types-examples/src/char.rs | examples/guide-supported-types-examples/src/char.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn take_char_by_value(x: char) {}
#[wasm_bindgen]
pub fn return_char() -> char {
'🚀'
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/guide-supported-types-examples/src/bool.rs | examples/guide-supported-types-examples/src/bool.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn take_bool_by_value(x: bool) {}
#[wasm_bindgen]
pub fn return_bool() -> bool {
true
}
#[wasm_bindgen]
pub fn take_option_bool(x: Option<bool>) {}
#[wasm_bindgen]
pub fn return_option_bool() -> Option<bool> {
Some(false)
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/guide-supported-types-examples/src/number_slices.rs | examples/guide-supported-types-examples/src/number_slices.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn take_number_slice_by_shared_ref(x: &[f64]) {}
#[wasm_bindgen]
pub fn take_number_slice_by_exclusive_ref(x: &mut [u8]) {}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/guide-supported-types-examples/src/boxed_number_slices.rs | examples/guide-supported-types-examples/src/boxed_number_slices.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn take_boxed_number_slice_by_value(x: Box<[f64]>) {}
#[wasm_bindgen]
pub fn return_boxed_number_slice() -> Box<[u32]> {
(0..42).collect::<Vec<u32>>().into_boxed_slice()
}
#[wasm_bindgen]
pub fn take_option_boxed_number_slice(x: Option<Box<[u8]>>) {}
#[wasm_bind... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/guide-supported-types-examples/src/boxed_js_value_slice.rs | examples/guide-supported-types-examples/src/boxed_js_value_slice.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn take_boxed_js_value_slice_by_value(x: Box<[JsValue]>) {}
#[wasm_bindgen]
pub fn return_boxed_js_value_slice() -> Box<[JsValue]> {
vec![JsValue::NULL, JsValue::UNDEFINED].into_boxed_slice()
}
#[wasm_bindgen]
pub fn take_option_boxed_js_value_slice(x: Option<Box... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/guide-supported-types-examples/src/numbers.rs | examples/guide-supported-types-examples/src/numbers.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn take_number_by_value(x: u32) {}
#[wasm_bindgen]
pub fn return_number() -> f64 {
42.0
}
#[wasm_bindgen]
pub fn take_option_number(x: Option<u8>) {}
#[wasm_bindgen]
pub fn return_option_number() -> Option<i16> {
Some(-300)
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/guide-supported-types-examples/src/non_null.rs | examples/guide-supported-types-examples/src/non_null.rs | use std::ptr;
use std::ptr::NonNull;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub unsafe fn take_pointer_by_value(x: Option<NonNull<u8>>) {
Box::from_raw(x.unwrap().as_ptr());
}
#[wasm_bindgen]
pub fn return_pointer() -> Option<NonNull<u8>> {
Some(NonNull::from(Box::leak(Box::new(42))))
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/guide-supported-types-examples/src/imported_types.rs | examples/guide-supported-types-examples/src/imported_types.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
#[derive(Copy, Clone, Debug)]
pub enum NumberEnum {
Foo = 0,
Bar = 1,
Qux = 2,
}
#[wasm_bindgen]
#[derive(Copy, Clone, Debug)]
pub enum StringEnum {
Foo = "foo",
Bar = "bar",
Qux = "qux",
}
#[wasm_bindgen]
pub struct Struct {
pub number: Numbe... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/guide-supported-types-examples/src/str.rs | examples/guide-supported-types-examples/src/str.rs | use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn take_str_by_shared_ref(x: &str) {}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/webaudio/src/lib.rs | examples/webaudio/src/lib.rs | use wasm_bindgen::prelude::*;
use web_sys::{AudioContext, OscillatorType};
/// Converts a midi note to frequency
///
/// A midi note is an integer, generally in the range of 21 to 108
pub fn midi_to_freq(note: u8) -> f32 {
27.5 * 2f32.powf((note as f32 - 21.0) / 12.0)
}
#[wasm_bindgen]
pub struct FmOsc {
ctx:... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/paint/src/lib.rs | examples/paint/src/lib.rs | use std::cell::Cell;
use std::rc::Rc;
use wasm_bindgen::prelude::*;
#[wasm_bindgen(start)]
fn start() -> Result<(), JsValue> {
let document = web_sys::window().unwrap().document().unwrap();
let canvas = document
.create_element("canvas")?
.dyn_into::<web_sys::HtmlCanvasElement>()?;
document... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/todomvc/src/element.rs | examples/todomvc/src/element.rs | use wasm_bindgen::prelude::*;
use web_sys::EventTarget;
/// Wrapper for `web_sys::Element` to simplify calling different interfaces
pub struct Element {
el: Option<web_sys::Element>,
}
impl From<web_sys::Element> for Element {
fn from(el: web_sys::Element) -> Element {
Element { el: Some(el) }
}
}... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/todomvc/src/lib.rs | examples/todomvc/src/lib.rs | //! # TODO MVC
//!
//! A [TODO MVC](http://todomvc.com/) implementation written using [web-sys](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/overview.html)
use wasm_bindgen::prelude::*;
use std::rc::Rc;
/// Controller of the program
pub mod controller;
/// Element wrapper to the DOM
pub mod element;
/// Sched... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/todomvc/src/store.rs | examples/todomvc/src/store.rs | use js_sys::JSON;
use wasm_bindgen::prelude::*;
/// Stores items into localstorage
pub struct Store {
local_storage: web_sys::Storage,
data: ItemList,
name: String,
}
impl Store {
/// Creates a new store with `name` as the localstorage value name
pub fn new(name: &str) -> Option<Store> {
l... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/todomvc/src/view.rs | examples/todomvc/src/view.rs | use crate::controller::ControllerMessage;
use crate::element::Element;
use crate::exit;
use crate::store::ItemList;
use crate::{Message, Scheduler};
use std::cell::RefCell;
use std::rc::Rc;
use crate::template::Template;
const ENTER_KEY: u32 = 13;
const ESCAPE_KEY: u32 = 27;
use wasm_bindgen::prelude::*;
/// Messag... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/todomvc/src/template.rs | examples/todomvc/src/template.rs | use crate::store::{ItemList, ItemListTrait};
use askama::Template as AskamaTemplate;
#[derive(AskamaTemplate)]
#[template(path = "row.html")]
struct RowTemplate<'a> {
id: &'a str,
title: &'a str,
completed: bool,
}
#[derive(AskamaTemplate)]
#[template(path = "itemsLeft.html")]
struct ItemsLeftTemplate {
... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/todomvc/src/controller.rs | examples/todomvc/src/controller.rs | use crate::exit;
use crate::store::*;
use crate::view::ViewMessage;
use crate::{Message, Scheduler};
use js_sys::Date;
use std::cell::RefCell;
use std::rc::Weak;
/// The controller of the application turns page state into functionality
pub struct Controller {
store: Store,
sched: RefCell<Option<Weak<Scheduler... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/todomvc/src/build.rs | examples/todomvc/src/build.rs | extern crate askama;
fn main() {
askama::rerun_if_templates_changed();
}
| rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/todomvc/src/scheduler.rs | examples/todomvc/src/scheduler.rs | use crate::controller::Controller;
use crate::exit;
use crate::view::View;
use crate::Message;
use std::cell::RefCell;
use std::rc::Rc;
/// Creates an event loop that starts each time a message is added
pub struct Scheduler {
controller: Rc<RefCell<Option<Controller>>>,
view: Rc<RefCell<Option<View>>>,
eve... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
wasm-bindgen/wasm-bindgen | https://github.com/wasm-bindgen/wasm-bindgen/blob/dda4821ee2fbcaa7adc58bc8c385ed8d3627a272/examples/raytrace-parallel/src/lib.rs | examples/raytrace-parallel/src/lib.rs | use futures_channel::oneshot;
use js_sys::{Promise, Uint8ClampedArray, WebAssembly};
use rayon::prelude::*;
use wasm_bindgen::prelude::*;
use web_sys::ImageData;
macro_rules! console_log {
($($t:tt)*) => (crate::log(&format_args!($($t)*).to_string()))
}
mod pool;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(j... | rust | Apache-2.0 | dda4821ee2fbcaa7adc58bc8c385ed8d3627a272 | 2026-01-04T15:46:52.814516Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.