CodeSampleX

Sample

wasm-bindgen-macro 0.2.128

Verified sample for cargo wasm-bindgen-macro 0.2.128. The contract ran on rust 1 · linux alpine/x64 · docker and passed: wasm_bindgen exports standalone…

sha256:419b1df0631d89b19f2ab6ebb653ce8800faa27f389f2d2c8a24a5f4e80b9c0a

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 · alpine · musl 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-17

Case

HOW
Goal
verify pkg:cargo/wasm-bindgen-macro@0.2.128
Packages
Created
2026-10-17T10:03:32Z

Contract

  1. wasm_bindgen exports standalone functions accepting primitives and string slices
  2. wasm_bindgen exports C-like enums preserving explicit discriminant values
  3. wasm_bindgen constructor initializes exported struct instances
  4. wasm_bindgen getter and setter attributes read and update struct properties
  5. wasm_bindgen methods mutate and query struct state

Files

  • Cargo.lock
  • Cargo.toml
  • PROMPT.md
  • csx.json
  • spec.json
  • src/lib.rs
  • test/contract.rs

Download the source artifact (tar.gz)

Source

Cargo.lock
# 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 = "cfg-if"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"

[[package]]
name = "once_cell"
version = "1.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"

[[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 = "rustversion"
version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"

[[package]]
name = "sample-wasm-bindgen-macro"
version = "0.1.0"
dependencies = [
 "wasm-bindgen",
 "wasm-bindgen-macro",
]

[[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"
version = "0.2.128"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aecb87a33d3b0c5e3b7aa46336eaf486cffafbd281b195e4c8b80d50df2351bf"
dependencies = [
 "cfg-if",
 "once_cell",
 "rustversion",
 "wasm-bindgen-macro",
 "wasm-bindgen-shared",
]

[[package]]
name = "wasm-bindgen-macro"
version = "0.2.128"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a690d511e3c1a8b3a55e33511e3c2c00c78415cd23650f32b808627f5696b9ed"
dependencies = [
 "quote",
 "wasm-bindgen-macro-support",
]

[[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",
]
Cargo.toml
[package]
name = "sample-wasm-bindgen-macro"
version = "0.1.0"
edition = "2021"
publish = false

[dependencies]
wasm-bindgen-macro = "=0.2.128"
wasm-bindgen = "=0.2.128"

[[bin]]
name = "contract"
path = "test/contract.rs"
PROMPT.md
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 pkg:cargo/wasm-bindgen-macro@0.2.128
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:cargo/wasm-bindgen-macro@0.2.128

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.
csx.json
{"case":{"caseId":"case:sha256:6f91466e69e06e73944ca53098feeec06315164d14a86baafb7d83eca956fa67","contract":["wasm_bindgen exports standalone functions accepting primitives and string slices","wasm_bindgen exports C-like enums preserving explicit discriminant values","wasm_bindgen constructor initializes exported struct instances","wasm_bindgen getter and setter attributes read and update struct properties","wasm_bindgen methods mutate and query struct state"],"goal":"verify pkg:cargo/wasm-bindgen-macro@0.2.128","kind":"HOW","packages":["pkg:cargo/wasm-bindgen-macro@0.2.128"],"schemaVersion":1},"contractCommand":["cargo","run","--offline"],"environment":{"arch":"x64","distro":"alpine","ecosystem":"cargo","libc":"musl","os":"linux","packageManager":"cargo","schemaVersion":1},"license":"MIT-0","packages":["pkg:cargo/wasm-bindgen-macro@0.2.128"],"schemaVersion":1,"subject":"pkg:cargo/wasm-bindgen-macro@0.2.128","verifierAdapter":"cargo@1"}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:cargo/wasm-bindgen-macro@0.2.128",
  "kind": "HOW",
  "packages": [
    "pkg:cargo/wasm-bindgen-macro@0.2.128"
  ]
}
src/lib.rs
//! Verification sample for wasm-bindgen-macro.

pub use wasm_bindgen_macro::*;
test/contract.rs
use wasm_bindgen_macro::wasm_bindgen;

#[wasm_bindgen]
pub fn multiply_add(x: i32, y: i32, offset: i32) -> i32 {
    x * y + offset
}

#[wasm_bindgen]
pub fn format_tag(prefix: &str, code: u32) -> String {
    format!("{}-{:04}", prefix, code)
}

#[wasm_bindgen]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PriorityLevel {
    Low = 10,
    Normal = 20,
    Critical = 100,
}

#[wasm_bindgen]
pub struct CounterBox {
    count: u64,
    name: String,
    locked: bool,
}

#[wasm_bindgen]
impl CounterBox {
    #[wasm_bindgen(constructor)]
    pub fn new(initial: u64, name: String) -> CounterBox {
        CounterBox {
            count: initial,
            name,
            locked: false,
        }
    }

    #[wasm_bindgen(getter)]
    pub fn count(&self) -> u64 {
        self.count
    }

    #[wasm_bindgen(getter)]
    pub fn name(&self) -> String {
        self.name.clone()
    }

    #[wasm_bindgen(setter)]
    pub fn set_name(&mut self, name: String) {
        if !self.locked {
            self.name = name;
        }
    }

    pub fn increment(&mut self, delta: u64) -> u64 {
        if !self.locked {
            self.count += delta;
        }
        self.count
    }

    pub fn lock(&mut self) {
        self.locked = true;
    }

    pub fn is_locked(&self) -> bool {
        self.locked
    }
}

fn main() {
    // 1. wasm_bindgen exports standalone functions accepting primitives and string slices
    assert_eq!(multiply_add(6, 7, -2), 40);
    assert_eq!(format_tag("ITEM", 42), "ITEM-0042");

    // 2. wasm_bindgen exports C-like enums preserving explicit discriminant values
    assert_eq!(PriorityLevel::Low as i32, 10);
    assert_eq!(PriorityLevel::Normal as i32, 20);
    assert_eq!(PriorityLevel::Critical as i32, 100);

    // 3. wasm_bindgen constructor initializes exported struct instances
    let mut box_item = CounterBox::new(5, "alpha".to_string());
    assert_eq!(box_item.count(), 5);
    assert_eq!(box_item.name(), "alpha");
    assert!(!box_item.is_locked());

    // 4. wasm_bindgen getter and setter attributes read and update struct properties
    box_item.set_name("beta".to_string());
    assert_eq!(box_item.name(), "beta");

    // 5. wasm_bindgen methods mutate and query struct state
    assert_eq!(box_item.increment(15), 20);
    box_item.lock();
    assert!(box_item.is_locked());
    assert_eq!(box_item.increment(10), 20);
}

Origin Seeder

anonymous