サンプル
anstream 1.0.0: anstream
検証済みサンプル — cargo anstream 1.0.0: anstream. rust 1 · linux alpine/x64 · docker で contract を実行し、成功しました: AutoStream::always_ansi preserves ANSI escape codes…
sha256:ce43394313c0ecd0bcce6a0e7f6bf56e097c9d8ac3ee214bb20c0352eddf1a1a
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
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 anstream in pkg:cargo/anstream@1.0.0
- パッケージ
- シンボル
-
- anstream
- 作成日
- 2026-10-09T22:40:53Z
コントラクト
- AutoStream::always_ansi preserves ANSI escape codes when writing to stream
- AutoStream::never strips ANSI escape codes from written output
- StripStream strips ANSI escape sequences unconditionally
- AutoStream::new configures stream behavior according to ColorChoice
- anstream::adapter::strip_str removes ANSI escape codes from string references
ファイル
- 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 = "anstream"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d"
dependencies = [
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
"is_terminal_polyfill",
"utf8parse",
]
[[package]]
name = "anstyle"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
[[package]]
name = "anstyle-parse"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
dependencies = [
"windows-sys",
]
[[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 = "colorchoice"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570"
[[package]]
name = "is_terminal_polyfill"
version = "1.70.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"
[[package]]
name = "once_cell_polyfill"
version = "1.70.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
[[package]]
name = "sample-anstream"
version = "1.0.0"
dependencies = [
"anstream",
]
[[package]]
name = "utf8parse"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[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",
]
[package]
name = "sample-anstream"
version = "1.0.0"
edition = "2021"
publish = false
[dependencies]
anstream = "=1.0.0"
[[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 anstream in pkg:cargo/anstream@1.0.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/anstream@1.0.0
Demonstrate these symbols/APIs:
- anstream
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:3a4aea983ff3ff91534c745b3568ed0877cd55a79aea2429068c886b65ca2a0b","contract":["AutoStream::always_ansi preserves ANSI escape codes when writing to stream","AutoStream::never strips ANSI escape codes from written output","StripStream strips ANSI escape sequences unconditionally","AutoStream::new configures stream behavior according to ColorChoice","anstream::adapter::strip_str removes ANSI escape codes from string references"],"goal":"verify anstream in pkg:cargo/anstream@1.0.0","kind":"HOW","packages":["pkg:cargo/anstream@1.0.0"],"schemaVersion":1,"symbols":["anstream"]},"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/anstream@1.0.0"],"schemaVersion":1,"subject":"pkg:cargo/anstream@1.0.0","symbols":["anstream"],"verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify anstream in pkg:cargo/anstream@1.0.0",
"kind": "HOW",
"packages": [
"pkg:cargo/anstream@1.0.0"
],
"symbols": [
"anstream"
]
}
//! Clean-room verification sample for anstream.
pub use anstream::*;
use anstream::adapter::strip_str;
use anstream::{AutoStream, ColorChoice, StripStream};
use std::io::Write;
fn main() {
// 1. AutoStream::always_ansi preserves ANSI escape codes when writing to stream
let mut stream = AutoStream::always_ansi(Vec::new());
write!(stream, "\x1b[31mred text\x1b[0m").expect("write to always_ansi");
assert_eq!(stream.into_inner(), b"\x1b[31mred text\x1b[0m");
// 2. AutoStream::never strips ANSI escape codes from written output
let mut stream = AutoStream::never(Vec::new());
write!(stream, "\x1b[32mgreen text\x1b[0m").expect("write to never");
assert_eq!(stream.into_inner(), b"green text");
// 3. StripStream strips ANSI escape sequences unconditionally
let mut stream = StripStream::new(Vec::new());
write!(stream, "\x1b[1mbold\x1b[0m and \x1b[4munderline\x1b[0m").expect("write to StripStream");
assert_eq!(stream.into_inner(), b"bold and underline");
// 4. AutoStream::new configures stream behavior according to ColorChoice
let mut never_stream = AutoStream::new(Vec::new(), ColorChoice::Never);
write!(never_stream, "\x1b[33myellow\x1b[0m").expect("write to never_stream");
assert_eq!(never_stream.into_inner(), b"yellow");
let mut ansi_stream = AutoStream::new(Vec::new(), ColorChoice::AlwaysAnsi);
write!(ansi_stream, "\x1b[34mblue\x1b[0m").expect("write to ansi_stream");
assert_eq!(ansi_stream.into_inner(), b"\x1b[34mblue\x1b[0m");
// 5. anstream::adapter::strip_str removes ANSI escape codes from string references
let styled = "\x1b[31;1mError:\x1b[0m file not found";
let stripped = strip_str(styled).to_string();
assert_eq!(stripped, "Error: file not found");
println!("All anstream contract assertions passed successfully.");
}
オリジンシーダー
匿名