CodeSampleX

샘플

wasm-bindgen-shared 0.2.127

검증된 샘플 — cargo wasm-bindgen-shared 0.2.127. rust 1 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: SCHEMA_VERSION specifies the shared protocol version…

sha256:5f1419f810e357dc1d0b37df02b651708150e0177832f82b1dd63a5f3ab9c7e3

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. 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-09-19

케이스

HOW
목표
verify pkg:cargo/wasm-bindgen-shared@0.2.127
패키지
생성일
2026-09-19T04:33:57Z

컨트랙트

  1. SCHEMA_VERSION specifies the shared protocol version string
  2. version returns the crate package version string
  3. qualified_name disambiguates JavaScript names with namespaces joined by double underscores
  4. symbol naming helpers construct standardized wasm-bindgen export and helper names
  5. escape_string escapes special characters in strings
  6. identifier module validates and normalizes JavaScript identifiers
  7. tys module provides constant type discriminator identifiers

파일

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

소스 아티팩트 내려받기 (tar.gz)

소스

Cargo.lock
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4

[[package]]
name = "sample-wasm-bindgen-shared"
version = "1.0.0"
dependencies = [
 "wasm-bindgen-shared",
]

[[package]]
name = "unicode-ident"
version = "1.0.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954"

[[package]]
name = "wasm-bindgen-shared"
version = "0.2.127"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ef64dbcc55df09c7e5a46182d181c2cfa3e925f3da937ea764728b4bbb9dcbf"
dependencies = [
 "unicode-ident",
]
Cargo.toml
[package]
name = "sample-wasm-bindgen-shared"
version = "1.0.0"
edition = "2021"
publish = false

[dependencies]
wasm-bindgen-shared = "=0.2.127"

[[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-shared@0.2.127
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:cargo/wasm-bindgen-shared@0.2.127
Required runtime conditions:
  - ecosystem: golang
  - language: go
  - packageManager: go@1.26.6
  - runtime: go@1.26.6

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:38a4c568d06f261e40fb4afece22034a7ff06f4c86a22b68459771bd53063315","contract":["SCHEMA_VERSION specifies the shared protocol version string","version returns the crate package version string","qualified_name disambiguates JavaScript names with namespaces joined by double underscores","symbol naming helpers construct standardized wasm-bindgen export and helper names","escape_string escapes special characters in strings","identifier module validates and normalizes JavaScript identifiers","tys module provides constant type discriminator identifiers"],"goal":"verify pkg:cargo/wasm-bindgen-shared@0.2.127","kind":"HOW","packages":["pkg:cargo/wasm-bindgen-shared@0.2.127"],"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-shared@0.2.127"],"schemaVersion":1,"subject":"pkg:cargo/wasm-bindgen-shared@0.2.127","verifierAdapter":"cargo@1"}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:cargo/wasm-bindgen-shared@0.2.127",
  "kind": "HOW",
  "packages": [
    "pkg:cargo/wasm-bindgen-shared@0.2.127"
  ]
}
src/lib.rs
//! Clean-room verification sample for wasm-bindgen-shared.

pub use wasm_bindgen_shared::*;
test/contract.rs
use wasm_bindgen_shared::{
    dynamic_union_variant, escape_string, free_function, free_function_export_name,
    identifier, new_function, qualified_name, struct_field_get, struct_field_set,
    struct_function_export_name, tys, unwrap_function, upcast_function, version,
    SCHEMA_VERSION,
};

fn main() {
    // 1. SCHEMA_VERSION specifies the shared protocol version string
    assert_eq!(SCHEMA_VERSION, "0.2.122");

    // 2. version returns the crate package version string
    let ver = version();
    assert!(ver.starts_with("0.2.127"));

    // 3. qualified_name disambiguates JavaScript names with namespaces joined by double underscores
    let ns = ["window", "document"];
    assert_eq!(qualified_name(Some(&ns), "body"), "window__document__body");
    let no_ns: Option<&[&str]> = None;
    assert_eq!(qualified_name(no_ns, "alert"), "alert");
    let empty_ns: [&str; 0] = [];
    assert_eq!(qualified_name(Some(&empty_ns), "alert"), "alert");

    // 4. symbol naming helpers construct standardized wasm-bindgen export and helper names
    assert_eq!(new_function("MyClass"), "__wbg_myclass_new");
    assert_eq!(free_function("MyClass"), "__wbg_myclass_free");
    assert_eq!(unwrap_function("MyClass"), "__wbg_myclass_unwrap");
    assert_eq!(upcast_function("Child", "Parent"), "__wbg_upcast_child_to_parent");
    assert_eq!(struct_field_get("MyClass", "field"), "__wbg_get_myclass_field");
    assert_eq!(struct_field_set("MyClass", "field"), "__wbg_set_myclass_field");
    assert_eq!(free_function_export_name("my_fn"), "my_fn");
    assert_eq!(struct_function_export_name("MyClass", "method"), "myclass_method");
    assert_eq!(dynamic_union_variant("MyUnion", 2), "__wbg_dynamic_union_myunion_2");

    // 5. escape_string escapes special characters in strings
    assert_eq!(escape_string("hello\n\"world\"\\"), "hello\\n\\\"world\\\"\\\\");
    assert_eq!(escape_string("test\r'string'"), "test\\r\\'string\\'");

    // 6. identifier module validates and normalizes JavaScript identifiers
    assert!(identifier::is_js_keyword("function"));
    assert!(identifier::is_js_keyword("class"));
    assert!(!identifier::is_js_keyword("custom_identifier"));

    assert!(identifier::is_non_value_js_keyword("let"));
    assert!(!identifier::is_non_value_js_keyword("this"));

    assert!(identifier::is_valid_ident("valid_name$1"));
    assert!(!identifier::is_valid_ident("123invalid"));
    assert!(!identifier::is_valid_ident("invalid-kebab"));

    assert_eq!(identifier::to_valid_ident("valid_name"), "valid_name");
    assert_eq!(identifier::to_valid_ident("invalid-name"), "invalid_name");
    assert_eq!(identifier::to_valid_ident("default"), "_default");

    // 7. tys module provides constant type discriminator identifiers
    assert_eq!(tys::I8, 0);
    assert_eq!(tys::U8, 1);
    assert_eq!(tys::I16, 2);
    assert_eq!(tys::U16, 3);
    assert_eq!(tys::I32, 4);
    assert_eq!(tys::U32, 5);
    assert_eq!(tys::BOOLEAN, 14);
    assert_eq!(tys::STRING, 18);

    println!("All wasm-bindgen-shared contract assertions passed successfully.");
}

오리진 시더

익명