샘플
wasm-bindgen-macro 0.2.127: wasm_bindgen_macro::wasm_bindgen
검증된 샘플 — cargo wasm-bindgen-macro 0.2.127: wasm_bindgen_macro::wasm_bindgen. rust 1 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다.
sha256:fcaf53122666fcbbdbcfc3351c6e137c2ad3e2b1436d6bf00b91e6b94f703605
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
linux · alpine · musl x64 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-09 |
케이스
HOW- 목표
- verify wasm_bindgen_macro::wasm_bindgen in pkg:cargo/wasm-bindgen-macro@0.2.127
- 심벌
-
- wasm_bindgen_macro::wasm_bindgen
- 생성일
- 2026-10-09T10:51:19Z
컨트랙트
- wasm_bindgen annotates standalone exported functions callable with primitive arguments and return values
- wasm_bindgen exports structs with methods, constructors, and mutators
- wasm_bindgen exports C-like enums with discriminants
- wasm_bindgen supports getter and setter methods on exported types
- wasm_bindgen processes functions operating on strings and byte slices
파일
- Cargo.lock
- Cargo.toml
- PROMPT.md
- csx.json
- spec.json
- src/lib.rs
- test/contract.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-macro"
version = "1.0.0"
dependencies = [
"wasm-bindgen",
"wasm-bindgen-macro",
]
[[package]]
name = "syn"
version = "2.0.119"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "unicode-ident"
version = "1.0.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954"
[[package]]
name = "wasm-bindgen"
version = "0.2.127"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b70935747edd64d89de3efa29d73789b806c15798f8e7dca4d8ac356b50ce70"
dependencies = [
"cfg-if",
"once_cell",
"rustversion",
"wasm-bindgen-macro",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.127"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77775f8f3f7217702089053b94958f8f54061a3f663417df76e19cbdcca29bc1"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.127"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e11d33f857dc2fb11b8bc75aee111aa9cbeb12cd9f25efd3d4c2a3dd4e235284"
dependencies = [
"bumpalo",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.127"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ef64dbcc55df09c7e5a46182d181c2cfa3e925f3da937ea764728b4bbb9dcbf"
dependencies = [
"unicode-ident",
]
[package]
name = "sample-wasm-bindgen-macro"
version = "1.0.0"
edition = "2021"
publish = false
[dependencies]
wasm-bindgen-macro = "=0.2.127"
wasm-bindgen = "=0.2.127"
[[bin]]
name = "contract"
path = "test/contract.rs"
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_macro::wasm_bindgen in pkg:cargo/wasm-bindgen-macro@0.2.127
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/wasm-bindgen-macro@0.2.127
Demonstrate these symbols/APIs:
- wasm_bindgen_macro::wasm_bindgen
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:bcaa94d95d54fb7a7ffb9ff498b3e9ff61f3f4103eb9f42894643c97263e647a","contract":["wasm_bindgen annotates standalone exported functions callable with primitive arguments and return values","wasm_bindgen exports structs with methods, constructors, and mutators","wasm_bindgen exports C-like enums with discriminants","wasm_bindgen supports getter and setter methods on exported types","wasm_bindgen processes functions operating on strings and byte slices"],"goal":"verify wasm_bindgen_macro::wasm_bindgen in pkg:cargo/wasm-bindgen-macro@0.2.127","kind":"HOW","packages":["pkg:cargo/wasm-bindgen-macro@0.2.127"],"schemaVersion":1,"symbols":["wasm_bindgen_macro::wasm_bindgen"]},"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.127"],"schemaVersion":1,"subject":"pkg:cargo/wasm-bindgen-macro@0.2.127","symbols":["wasm_bindgen_macro::wasm_bindgen"],"verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify wasm_bindgen_macro::wasm_bindgen in pkg:cargo/wasm-bindgen-macro@0.2.127",
"kind": "HOW",
"packages": [
"pkg:cargo/wasm-bindgen-macro@0.2.127"
],
"symbols": [
"wasm_bindgen_macro::wasm_bindgen"
]
}
//! Clean-room verification sample for wasm-bindgen-macro.
pub use wasm_bindgen_macro::*;
use wasm_bindgen_macro::wasm_bindgen;
// 1. wasm_bindgen annotates standalone exported functions callable with primitive arguments and return values
#[wasm_bindgen]
pub fn add_numbers(a: i32, b: i32) -> i32 {
a + b
}
// 2. wasm_bindgen exports structs with methods, constructors, and mutators
#[wasm_bindgen]
pub struct Counter {
val: i32,
}
#[wasm_bindgen]
impl Counter {
#[wasm_bindgen(constructor)]
pub fn new(initial: i32) -> Counter {
Counter { val: initial }
}
pub fn value(&self) -> i32 {
self.val
}
pub fn increment(&mut self) {
self.val += 1;
}
}
// 3. wasm_bindgen exports C-like enums with discriminants
#[wasm_bindgen]
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum Status {
Inactive = 0,
Active = 1,
Pending = 2,
}
// 4. wasm_bindgen supports getter and setter methods on exported types
#[wasm_bindgen]
pub struct Config {
port: u16,
}
#[wasm_bindgen]
impl Config {
#[wasm_bindgen(constructor)]
pub fn new(port: u16) -> Config {
Config { port }
}
#[wasm_bindgen(getter)]
pub fn port(&self) -> u16 {
self.port
}
#[wasm_bindgen(setter)]
pub fn set_port(&mut self, port: u16) {
self.port = port;
}
}
// 5. wasm_bindgen processes functions operating on strings and byte slices
#[wasm_bindgen]
pub fn greet(name: &str) -> String {
format!("Hello, {name}!")
}
#[wasm_bindgen]
pub fn byte_len(data: &[u8]) -> usize {
data.len()
}
fn main() {
// 1. Standalone function with primitive arguments and return value
assert_eq!(add_numbers(17, 25), 42);
// 2. Struct constructor and methods
let mut counter = Counter::new(100);
assert_eq!(counter.value(), 100);
counter.increment();
assert_eq!(counter.value(), 101);
// 3. C-like enum discriminants
let s_active = Status::Active;
assert_eq!(s_active as u32, 1);
let s_pending = Status::Pending;
assert_eq!(s_pending as u32, 2);
assert_ne!(s_active, s_pending);
// 4. Getter and setter methods
let mut config = Config::new(8080);
assert_eq!(config.port(), 8080);
config.set_port(9090);
assert_eq!(config.port(), 9090);
// 5. String and byte slice operations
let greeting = greet("CodeSampleX");
assert_eq!(greeting, "Hello, CodeSampleX!");
let data = [1u8, 2, 3, 4, 5];
assert_eq!(byte_len(&data), 5);
println!("All wasm_bindgen_macro contract assertions passed successfully.");
}
오리진 시더
익명