Exemple
wasm-bindgen 0.2.128: wasm_bindgen::JsValue
Échantillon vérifié pour cargo wasm-bindgen 0.2.128: wasm_bindgen::JsValue. Le contrat s'est exécuté sur rust 1 · linux alpine/x64 · docker et a réussi.
sha256:2cbd11f866739b619c8ef890b31ac8fbccda217f9609e35b7979046b528d654c
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
linux x64 rust cargo
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| 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 |
Cas
HOW- Objectif
- verify wasm_bindgen::JsValue in pkg:cargo/wasm-bindgen@0.2.128
- Paquets
- Symboles
-
- wasm_bindgen::JsValue
- Créé
- 2026-10-17T11:21:49Z
Contrat
- JsValue::undefined(), JsValue::null(), JsValue::from_bool(true), and JsValue::from_bool(false) construct singleton constants matching JsValue::UNDEFINED, JsValue::NULL, JsValue::TRUE, and JsValue::FALSE
- JsValue::default(), From<bool>, and From<Option<bool>> convert bool and Option<bool> values into their corresponding reserved JsValue constants without invoking imported JS functions
- IntoWasmAbi, FromWasmAbi, and OptionIntoWasmAbi roundtrip reserved JsValue handles and map None::<JsValue> to JsValue::UNDEFINED
- JsCast and TryFromJsValue on JsValue confirm has_type, is_instance_of, dyn_ref, dyn_into, unchecked_into, and try_from_js_value succeed on host targets
Fichiers
- Cargo.lock
- Cargo.toml
- PROMPT.md
- csx.json
- spec.json
- src/main.rs
Code 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 = "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-jsvalue"
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-jsvalue"
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 wasm_bindgen::JsValue in pkg:cargo/wasm-bindgen@0.2.128
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/wasm-bindgen@0.2.128
Demonstrate these symbols/APIs:
- wasm_bindgen::JsValue
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:316cc3a00d453cacc32fe8649f7dcca87399e7213e22ad668471d8651e4ec703","contract":["JsValue::undefined(), JsValue::null(), JsValue::from_bool(true), and JsValue::from_bool(false) construct singleton constants matching JsValue::UNDEFINED, JsValue::NULL, JsValue::TRUE, and JsValue::FALSE","JsValue::default(), From\u003cbool\u003e, and From\u003cOption\u003cbool\u003e\u003e convert bool and Option\u003cbool\u003e values into their corresponding reserved JsValue constants without invoking imported JS functions","IntoWasmAbi, FromWasmAbi, and OptionIntoWasmAbi roundtrip reserved JsValue handles and map None::\u003cJsValue\u003e to JsValue::UNDEFINED","JsCast and TryFromJsValue on JsValue confirm has_type, is_instance_of, dyn_ref, dyn_into, unchecked_into, and try_from_js_value succeed on host targets"],"goal":"verify wasm_bindgen::JsValue in pkg:cargo/wasm-bindgen@0.2.128","kind":"HOW","packages":["pkg:cargo/wasm-bindgen@0.2.128"],"schemaVersion":1,"symbols":["wasm_bindgen::JsValue"]},"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","symbols":["wasm_bindgen::JsValue"],"verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify wasm_bindgen::JsValue in pkg:cargo/wasm-bindgen@0.2.128",
"kind": "HOW",
"packages": [
"pkg:cargo/wasm-bindgen@0.2.128"
],
"symbols": [
"wasm_bindgen::JsValue"
]
}
use wasm_bindgen::convert::{FromWasmAbi, IntoWasmAbi, OptionIntoWasmAbi, TryFromJsValue};
use wasm_bindgen::{JsCast, JsValue};
fn main() {
// 1. Constants and static constructors
let undef = JsValue::undefined();
let null = JsValue::null();
let bool_true = JsValue::from_bool(true);
let bool_false = JsValue::from_bool(false);
assert_eq!(undef.into_abi(), JsValue::UNDEFINED.into_abi());
assert_eq!(null.into_abi(), JsValue::NULL.into_abi());
assert_eq!(bool_true.into_abi(), JsValue::TRUE.into_abi());
assert_eq!(bool_false.into_abi(), JsValue::FALSE.into_abi());
// 2. Default, From<bool>, From<Option<bool>>
assert_eq!(JsValue::default().into_abi(), JsValue::UNDEFINED.into_abi());
assert_eq!(JsValue::from(true).into_abi(), JsValue::TRUE.into_abi());
assert_eq!(JsValue::from(false).into_abi(), JsValue::FALSE.into_abi());
assert_eq!(JsValue::from(Some(true)).into_abi(), JsValue::TRUE.into_abi());
assert_eq!(JsValue::from(None::<bool>).into_abi(), JsValue::UNDEFINED.into_abi());
// 3. IntoWasmAbi, FromWasmAbi, OptionIntoWasmAbi
let raw_true = JsValue::TRUE.into_abi();
let roundtrip = unsafe { JsValue::from_abi(raw_true) };
assert_eq!((&roundtrip).into_abi(), raw_true);
assert_eq!(<JsValue as OptionIntoWasmAbi>::none(), JsValue::UNDEFINED.into_abi());
assert_eq!(Some(JsValue::NULL).into_abi(), JsValue::NULL.into_abi());
assert_eq!(None::<JsValue>.into_abi(), JsValue::UNDEFINED.into_abi());
// 4. JsCast and TryFromJsValue on JsValue
let val = JsValue::null();
assert!(val.has_type::<JsValue>());
assert!(val.is_instance_of::<JsValue>());
assert!(val.dyn_ref::<JsValue>().is_some());
assert_eq!(val.as_ref().into_abi(), JsValue::NULL.into_abi());
let casted: JsValue = val.dyn_into::<JsValue>().expect("JsValue casts to JsValue");
assert_eq!(casted.into_abi(), JsValue::NULL.into_abi());
let unchecked: JsValue = JsValue::TRUE.unchecked_into::<JsValue>();
assert_eq!(unchecked.into_abi(), JsValue::TRUE.into_abi());
let tried: JsValue = JsValue::try_from_js_value(JsValue::FALSE).expect("TryFromJsValue");
assert_eq!(tried.into_abi(), JsValue::FALSE.into_abi());
}
Seeder d'origine
anonyme