샘플
anstyle-parse 1.0.0
검증된 샘플 — cargo anstyle-parse 1.0.0. rust 1 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: Parser advances through ASCII text and dispatches characters…
sha256:d3809dab58e8c3c84d6cd81c8878221dc96e1eb88229d63de0abedd3ad9f1d23
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
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/anstyle-parse@1.0.0
- 생성일
- 2026-09-19T02:23:33Z
컨트랙트
- Parser advances through ASCII text and dispatches characters via Perform::print
- Parser decodes UTF-8 multi-byte sequences into unicode codepoints via Perform::print
- Parser dispatches CSI sequences with parameters, intermediates, and final action via Perform::csi_dispatch
- Parser executes C0 control characters via Perform::execute
- Parser dispatches OSC sequences with parameters and bell termination via Perform::osc_dispatch
파일
- 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 = "anstyle-parse"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e"
dependencies = [
"utf8parse",
]
[[package]]
name = "sample-anstyle-parse"
version = "1.0.0"
dependencies = [
"anstyle-parse",
]
[[package]]
name = "utf8parse"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[package]
name = "sample-anstyle-parse"
version = "1.0.0"
edition = "2021"
publish = false
[dependencies]
anstyle-parse = "=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 pkg:cargo/anstyle-parse@1.0.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/anstyle-parse@1.0.0
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:4da294b99e85b603a4428ee7b4ff8debf74e1e61608dcf893964a0aeb2f24ff1","contract":["Parser advances through ASCII text and dispatches characters via Perform::print","Parser decodes UTF-8 multi-byte sequences into unicode codepoints via Perform::print","Parser dispatches CSI sequences with parameters, intermediates, and final action via Perform::csi_dispatch","Parser executes C0 control characters via Perform::execute","Parser dispatches OSC sequences with parameters and bell termination via Perform::osc_dispatch"],"goal":"verify pkg:cargo/anstyle-parse@1.0.0","kind":"HOW","packages":["pkg:cargo/anstyle-parse@1.0.0"],"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/anstyle-parse@1.0.0"],"schemaVersion":1,"subject":"pkg:cargo/anstyle-parse@1.0.0","verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify pkg:cargo/anstyle-parse@1.0.0",
"kind": "HOW",
"packages": [
"pkg:cargo/anstyle-parse@1.0.0"
]
}
//! Clean-room verification sample for anstyle-parse.
pub use anstyle_parse::*;
use anstyle_parse::{DefaultCharAccumulator, Params, Parser, Perform};
#[derive(Default)]
struct PerformerCollector {
prints: Vec<char>,
executes: Vec<u8>,
csi_dispatches: Vec<(Vec<Vec<u16>>, Vec<u8>, bool, u8)>,
esc_dispatches: Vec<(Vec<u8>, bool, u8)>,
osc_dispatches: Vec<(Vec<Vec<u8>>, bool)>,
}
impl Perform for PerformerCollector {
fn print(&mut self, c: char) {
self.prints.push(c);
}
fn execute(&mut self, byte: u8) {
self.executes.push(byte);
}
fn csi_dispatch(&mut self, params: &Params, intermediates: &[u8], ignore: bool, action: u8) {
let param_list: Vec<Vec<u16>> = params.iter().map(|p| p.to_vec()).collect();
self.csi_dispatches.push((param_list, intermediates.to_vec(), ignore, action));
}
fn esc_dispatch(&mut self, intermediates: &[u8], ignore: bool, byte: u8) {
self.esc_dispatches.push((intermediates.to_vec(), ignore, byte));
}
fn osc_dispatch(&mut self, params: &[&[u8]], bell_terminated: bool) {
let param_list: Vec<Vec<u8>> = params.iter().map(|p| p.to_vec()).collect();
self.osc_dispatches.push((param_list, bell_terminated));
}
}
fn parse_bytes(input: &[u8]) -> PerformerCollector {
let mut parser = Parser::<DefaultCharAccumulator>::new();
let mut performer = PerformerCollector::default();
for &b in input {
parser.advance(&mut performer, b);
}
performer
}
fn main() {
// 1. Parser advances through ASCII text and dispatches characters via Perform::print
let collector = parse_bytes(b"Hello");
assert_eq!(collector.prints, vec!['H', 'e', 'l', 'l', 'o']);
assert!(collector.executes.is_empty());
assert!(collector.csi_dispatches.is_empty());
// 2. Parser decodes UTF-8 multi-byte sequences into unicode codepoints via Perform::print
let collector = parse_bytes("안녕, 世界! 🦀".as_bytes());
assert_eq!(collector.prints, vec!['안', '녕', ',', ' ', '世', '界', '!', ' ', '🦀']);
// 3. Parser dispatches CSI sequences with parameters, intermediates, and final action via Perform::csi_dispatch
let collector = parse_bytes(b"\x1b[31;1m");
assert_eq!(collector.csi_dispatches.len(), 1);
let (ref params, ref intermediates, ignore, action) = collector.csi_dispatches[0];
assert_eq!(params, &vec![vec![31], vec![1]]);
assert!(intermediates.is_empty());
assert!(!ignore);
assert_eq!(action, b'm');
// 4. Parser executes C0 control characters via Perform::execute
let collector = parse_bytes(b"\r\n\t");
assert_eq!(collector.executes, vec![b'\r', b'\n', b'\t']);
// 5. Parser dispatches OSC sequences with parameters and bell termination via Perform::osc_dispatch
let collector = parse_bytes(b"\x1b]0;terminal-title\x07");
assert_eq!(collector.osc_dispatches.len(), 1);
let (ref osc_params, bell_terminated) = collector.osc_dispatches[0];
assert_eq!(osc_params, &vec![b"0".to_vec(), b"terminal-title".to_vec()]);
assert!(bell_terminated);
println!("All anstyle-parse contract assertions passed successfully.");
}
오리진 시더
익명