Sample
wasm-bindgen-macro-support 0.2.128: expand
Verified sample for cargo wasm-bindgen-macro-support 0.2.128: expand. The contract ran on rust 1 · linux alpine/x64 · docker and passed.
sha256:f50ebe32fad0d24ecc574f031ffb86d6683612de9f5cba852e91c8408b7b80e6
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux x64 cargo
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| rust 1 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · cargo@1rust:1-alpine@sha256:a10e64dd139b… |
2026-10-18 |
Case
HOW- Goal
- verify expand in pkg:cargo/wasm-bindgen-macro-support@0.2.128
- Packages
- Symbols
-
- expand
- Created
- 2026-10-18T11:21:57Z
Contract
- expand("", "pub fn add_numbers(a: u32, b: u32) -> u32 { a + b }") returns Ok(TokenStream) containing pub fn add_numbers and __wasm_bindgen_generated_add_numbers
- expand("inspectable", "pub struct Counter { pub value: u32 }") emits #[derive(::wasm_bindgen::__rt::BindgenedStruct)] and #[__wasm_bindgen_retried], and re-invoking expand on the emitted struct returns Err(Diagnostic) when wasm_bindgen cannot be resolved
- expand("raw_module = \"./glue.js\"", "extern \"C\" { fn alert(msg: &str); }") returns Ok(TokenStream) containing fn alert and __wbg_alert_
- expand("", "pub enum Status { Idle = 0, Active = 1 }") returns Ok(TokenStream) containing pub enum Status, WasmDescribe, and IntoWasmAbi
Files
- Cargo.lock
- Cargo.toml
- PROMPT.md
- csx.json
- spec.json
- src/main.rs
- test/contract.rs
Source
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "bumpalo"
version = "3.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
[[package]]
name = "proc-macro2"
version = "1.0.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
dependencies = [
"proc-macro2",
]
[[package]]
name = "sample-wasm-bindgen-macro-support-expand"
version = "0.1.0"
dependencies = [
"wasm-bindgen-macro-support",
]
[[package]]
name = "syn"
version = "3.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "unicode-ident"
version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.128"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "411e4887f0071ef2d2164a9d5fdf2d20efbef78fccd3a78b0c10a1dc5295e48a"
dependencies = [
"bumpalo",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.128"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81941cd78d0c92026c33e5e01312845a4cb1e9af3407f9134b100dd03144103e"
dependencies = [
"unicode-ident",
]
[package]
name = "sample-wasm-bindgen-macro-support-expand"
version = "0.1.0"
edition = "2021"
[dependencies]
wasm-bindgen-macro-support = "=0.2.128"
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify expand in pkg:cargo/wasm-bindgen-macro-support@0.2.128
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/wasm-bindgen-macro-support@0.2.128
Demonstrate these symbols/APIs:
- expand
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:1476dc82ba0f18b142d926a2f3bd4b8c106da73cb7ed704f5b820926cd62035f","contract":["expand(\"\", \"pub fn add_numbers(a: u32, b: u32) -\u003e u32 { a + b }\") returns Ok(TokenStream) containing pub fn add_numbers and __wasm_bindgen_generated_add_numbers","expand(\"inspectable\", \"pub struct Counter { pub value: u32 }\") emits #[derive(::wasm_bindgen::__rt::BindgenedStruct)] and #[__wasm_bindgen_retried], and re-invoking expand on the emitted struct returns Err(Diagnostic) when wasm_bindgen cannot be resolved","expand(\"raw_module = \\\"./glue.js\\\"\", \"extern \\\"C\\\" { fn alert(msg: \u0026str); }\") returns Ok(TokenStream) containing fn alert and __wbg_alert_","expand(\"\", \"pub enum Status { Idle = 0, Active = 1 }\") returns Ok(TokenStream) containing pub enum Status, WasmDescribe, and IntoWasmAbi"],"goal":"verify expand in pkg:cargo/wasm-bindgen-macro-support@0.2.128","kind":"HOW","packages":["pkg:cargo/wasm-bindgen-macro-support@0.2.128"],"schemaVersion":1,"symbols":["expand"]},"contractCommand":["cargo","run","--offline"],"environment":{"arch":"x64","ecosystem":"cargo","os":"linux","packageManager":"cargo","schemaVersion":1},"license":"MIT-0","packages":["pkg:cargo/wasm-bindgen-macro-support@0.2.128"],"schemaVersion":1,"subject":"pkg:cargo/wasm-bindgen-macro-support@0.2.128","symbols":["expand"],"verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify expand in pkg:cargo/wasm-bindgen-macro-support@0.2.128",
"kind": "HOW",
"packages": [
"pkg:cargo/wasm-bindgen-macro-support@0.2.128"
],
"symbols": [
"expand"
]
}
#[path = "../test/contract.rs"]
mod contract;
fn main() {
contract::verify();
}
use wasm_bindgen_macro_support::expand;
pub fn verify() {
// 1. expand on a standalone function generates wasm-bindgen export glue.
let fn_expanded = expand(
"".parse().unwrap(),
"pub fn add_numbers(a: u32, b: u32) -> u32 { a + b }"
.parse()
.unwrap(),
)
.expect("expand on function should succeed")
.to_string();
assert!(
fn_expanded.contains("pub fn add_numbers"),
"expected original function signature in expansion: {fn_expanded}"
);
assert!(
fn_expanded.contains("__wasm_bindgen_generated_add_numbers"),
"expected generated export wrapper in expansion: {fn_expanded}"
);
// 2. expand on a struct emits BindgenedStruct derive and __wasm_bindgen_retried marker,
// and rejects a second pass when the retry marker is already present.
let struct_pass1 = expand(
"inspectable".parse().unwrap(),
"pub struct Counter { pub value: u32 }".parse().unwrap(),
)
.expect("first-pass struct expand should succeed");
let struct_pass1_str = struct_pass1.to_string();
assert!(
struct_pass1_str.contains("BindgenedStruct")
&& struct_pass1_str.contains("__wasm_bindgen_retried"),
"expected BindgenedStruct derive and retry marker: {struct_pass1_str}"
);
let retry_err = expand("".parse().unwrap(), struct_pass1)
.expect_err("re-expanding a struct with __wasm_bindgen_retried must return Err");
let retry_dbg = format!("{retry_err:?}");
assert!(
retry_dbg.contains("cannot resolve a path to the `wasm_bindgen` crate"),
"unexpected retry diagnostic: {retry_dbg}"
);
// 3. expand on an extern "C" foreign module block generates JS import shims.
let extern_expanded = expand(
"raw_module = \"./glue.js\"".parse().unwrap(),
"extern \"C\" { fn alert(msg: &str); }".parse().unwrap(),
)
.expect("expand on extern block should succeed")
.to_string();
assert!(
extern_expanded.contains("fn alert"),
"expected imported function signature in expansion: {extern_expanded}"
);
assert!(
extern_expanded.contains("__wbg_alert_"),
"expected generated import shim symbol in expansion: {extern_expanded}"
);
// 4. expand on a C-style enum generates IntoWasmAbi / FromWasmAbi / WasmDescribe traits.
let enum_expanded = expand(
"".parse().unwrap(),
"pub enum Status { Idle = 0, Active = 1 }".parse().unwrap(),
)
.expect("expand on C-style enum should succeed")
.to_string();
assert!(
enum_expanded.contains("pub enum Status")
&& enum_expanded.contains("WasmDescribe")
&& enum_expanded.contains("IntoWasmAbi"),
"expected enum definition and wasm ABI traits in expansion: {enum_expanded}"
);
}
Origin Seeder
anonymous