CodeSampleX

サンプル

anstyle-wincon 3.0.11: anstyle_wincon::WinconStream

検証済みサンプル — cargo anstyle-wincon 3.0.11: anstyle_wincon::WinconStream. rust 1 · linux alpine/x64 · docker で contract を実行し、成功しました.

sha256:0269be61f096b4642bff96b829b8a91be221a127ca06a3aecea055d64cc776ea

このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。 合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。 MIT-0

実行証拠

宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。

証拠の基準
署名済みコントラクト合格
検証レシート
1
ビルドした署名鍵
1
宣言された環境 linux · 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/anstyle-wincon@3.0.11
パッケージ
シンボル
  • anstyle_wincon::WinconStream
作成日
2026-09-19T00:03:34Z

コントラクト

  1. assert WinconStream::write_colored writes data to Vec<u8> buffer and returns written length
  2. assert WinconStream::write_colored appends data on subsequent calls
  3. assert WinconStream is implemented for Box<dyn std::io::Write>

ファイル

  • Cargo.lock
  • Cargo.toml
  • PROMPT.md
  • csx.json
  • spec.json
  • src/main.rs

ソースアーティファクトをダウンロード (tar.gz)

ソース

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

[[package]]
name = "anstyle"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"

[[package]]
name = "anstyle-wincon"
version = "3.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
dependencies = [
 "anstyle",
 "once_cell_polyfill",
 "windows-sys",
]

[[package]]
name = "once_cell_polyfill"
version = "1.70.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"

[[package]]
name = "sample"
version = "0.1.0"
dependencies = [
 "anstyle-wincon",
]

[[package]]
name = "windows-link"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"

[[package]]
name = "windows-sys"
version = "0.61.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
dependencies = [
 "windows-link",
]
Cargo.toml
[package]
name = "sample"
version = "0.1.0"
edition = "2021"

[dependencies]
anstyle-wincon = "=3.0.11"
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/anstyle-wincon@3.0.11
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:cargo/anstyle-wincon@3.0.11
Demonstrate these symbols/APIs:
  - anstyle_wincon::WinconStream

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:de0dd0ce00807202ee20e58fc20685e763dcffd64936ea90deb54f684f3a4c09","contract":["assert WinconStream::write_colored writes data to Vec\u003cu8\u003e buffer and returns written length","assert WinconStream::write_colored appends data on subsequent calls","assert WinconStream is implemented for Box\u003cdyn std::io::Write\u003e"],"goal":"verify pkg:cargo/anstyle-wincon@3.0.11","kind":"HOW","packages":["pkg:cargo/anstyle-wincon@3.0.11"],"schemaVersion":1,"symbols":["anstyle_wincon::WinconStream"]},"contractCommand":["cargo","run","--offline"],"environment":{"arch":"x64","ecosystem":"cargo","libc":"musl","os":"linux","packageManager":"cargo","schemaVersion":1},"license":"MIT-0","packages":["pkg:cargo/anstyle-wincon@3.0.11"],"schemaVersion":1,"subject":"pkg:cargo/anstyle-wincon@3.0.11","symbols":["anstyle_wincon::WinconStream"],"verifierAdapter":"cargo@1"}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:cargo/anstyle-wincon@3.0.11",
  "kind": "HOW",
  "packages": [
    "pkg:cargo/anstyle-wincon@3.0.11"
  ],
  "symbols": [
    "anstyle_wincon::WinconStream"
  ]
}
src/main.rs
use anstyle_wincon::WinconStream;

fn main() {
    // 1. Verify WinconStream write_colored on concrete Vec<u8> buffer
    let mut buffer: Vec<u8> = Vec::new();
    let written = buffer
        .write_colored(None, None, b"contract payload")
        .expect("write_colored failed");
    assert_eq!(written, 16);
    assert_eq!(buffer, b"contract payload");

    // 2. Verify subsequent write_colored appends data correctly
    let written_more = buffer
        .write_colored(None, None, b" extended")
        .expect("extended write_colored failed");
    assert_eq!(written_more, 9);
    assert_eq!(buffer, b"contract payload extended");

    // 3. Verify WinconStream dynamic dispatch through Box<dyn std::io::Write>
    let mut writer: Box<dyn std::io::Write> = Box::new(Vec::new());
    let written_dyn = writer
        .write_colored(None, None, b"dynamic dispatch")
        .expect("dynamic write_colored failed");
    assert_eq!(written_dyn, 16);

    println!("All contract assertions passed successfully.");
}

オリジンシーダー

匿名