Пример
wasm-bindgen 0.2.128
Проверенный пример — cargo wasm-bindgen 0.2.128. Контракт выполнен на rust 1 · linux alpine/x64 · docker и пройден: #[wasm_bindgen] exports Rust enums…
sha256:17c0faafd14513f63daa1d70edd905ad01f27733869a31504add683064847908
Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла.
Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди.
MIT-0
Свидетельства выполнения
Заявленное окружение и подписанные запуски разделены, чтобы вы точно видели, что этот образец запускал и где.
- Основа свидетельства
- Подписанный контракт пройден
- Квитанции проверки
- 1
- Ключи подписи, собравшие его
- 1
Заявленная среда
linux x64 rust cargo
Среды запусков проверки
| Окружение | Контракт | Этапы | Запуск |
|---|---|---|---|
| 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 |
Кейс
HOW- Цель
- verify pkg:cargo/wasm-bindgen@0.2.128
- Пакеты
- Создан
- 2026-10-17T09:54:49Z
Контракт
- #[wasm_bindgen] exports Rust enums, structs, constructors, getters, setters, and functions that compile and execute on host targets when they do not invoke imported JS bindings
- Counter::new(10, Mode::Fast) initializes value to 10 and mode to Mode::Fast, increment(5) returns 15, set_value(20) updates value to 20, and add_values(20, 7) returns 27
- JsValue::null() and JsValue::undefined() construct singleton JsValue constants safe to drop on non-wasm targets without calling imported JS functions
- UnwrapThrowExt::unwrap_throw and expect_throw unwrap Ok(42) and Some(99) on host targets without invoking JS throw imports
Файлы
- Cargo.lock
- Cargo.toml
- PROMPT.md
- csx.json
- spec.json
- src/main.rs
Исходный код
# 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"
version = "0.1.0"
dependencies = [
"wasm-bindgen",
]
[[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",
]
[package]
name = "sample-wasm-bindgen"
version = "0.1.0"
edition = "2021"
[dependencies]
wasm-bindgen = "=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 pkg:cargo/wasm-bindgen@0.2.128
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/wasm-bindgen@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.
{"case":{"caseId":"case:sha256:518d716bae94738b53b61adb3bfa0756547f2080f574d2fe00a0f4f3398ea0de","contract":["#[wasm_bindgen] exports Rust enums, structs, constructors, getters, setters, and functions that compile and execute on host targets when they do not invoke imported JS bindings","Counter::new(10, Mode::Fast) initializes value to 10 and mode to Mode::Fast, increment(5) returns 15, set_value(20) updates value to 20, and add_values(20, 7) returns 27","JsValue::null() and JsValue::undefined() construct singleton JsValue constants safe to drop on non-wasm targets without calling imported JS functions","UnwrapThrowExt::unwrap_throw and expect_throw unwrap Ok(42) and Some(99) on host targets without invoking JS throw imports"],"goal":"verify pkg:cargo/wasm-bindgen@0.2.128","kind":"HOW","packages":["pkg:cargo/wasm-bindgen@0.2.128"],"schemaVersion":1,"symbols":["wasm_bindgen::prelude::wasm_bindgen","wasm_bindgen::JsValue","wasm_bindgen::UnwrapThrowExt"]},"contractCommand":["cargo","run","--offline"],"environment":{"arch":"x64","ecosystem":"cargo","language":"rust","os":"linux","packageManager":"cargo","schemaVersion":1},"license":"MIT-0","packages":["pkg:cargo/wasm-bindgen@0.2.128"],"schemaVersion":1,"subject":"pkg:cargo/wasm-bindgen@0.2.128","verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify pkg:cargo/wasm-bindgen@0.2.128",
"kind": "HOW",
"packages": [
"pkg:cargo/wasm-bindgen@0.2.128"
]
}
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsValue;
#[wasm_bindgen]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Mode {
Fast = 1,
Safe = 2,
}
#[wasm_bindgen]
pub struct Counter {
value: u32,
mode: Mode,
}
#[wasm_bindgen]
impl Counter {
#[wasm_bindgen(constructor)]
pub fn new(initial: u32, mode: Mode) -> Counter {
Counter {
value: initial,
mode,
}
}
pub fn increment(&mut self, delta: u32) -> u32 {
self.value += delta;
self.value
}
#[wasm_bindgen(getter)]
pub fn value(&self) -> u32 {
self.value
}
#[wasm_bindgen(setter)]
pub fn set_value(&mut self, value: u32) {
self.value = value;
}
#[wasm_bindgen(getter)]
pub fn mode(&self) -> Mode {
self.mode
}
}
#[wasm_bindgen]
pub fn add_values(a: u32, b: u32) -> u32 {
a + b
}
fn main() {
let mut counter = Counter::new(10, Mode::Fast);
assert_eq!(counter.value(), 10);
assert_eq!(counter.mode(), Mode::Fast);
assert_eq!(counter.increment(5), 15);
counter.set_value(20);
assert_eq!(counter.value(), 20);
assert_eq!(add_values(counter.value(), 7), 27);
let _null_val: JsValue = JsValue::null();
let _undef_val: JsValue = JsValue::undefined();
let ok_val: Result<u32, &str> = Ok(42);
assert_eq!(ok_val.unwrap_throw(), 42);
let some_val: Option<u32> = Some(99);
assert_eq!(some_val.expect_throw("present"), 99);
}
Исходный сидер
аноним