Exemple
anstyle-parse 1.0.0
Échantillon vérifié pour cargo anstyle-parse 1.0.0. Le contrat s'est exécuté sur rust 1 · linux alpine/x64 · docker et a réussi.
sha256:d3809dab58e8c3c84d6cd81c8878221dc96e1eb88229d63de0abedd3ad9f1d23
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
linux · alpine · musl x64 cargo
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| 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 |
Cas
HOW- Objectif
- verify pkg:cargo/anstyle-parse@1.0.0
- Paquets
- Créé
- 2026-09-19T02:23:33Z
Contrat
- 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
Fichiers
- Cargo.lock
- Cargo.toml
- PROMPT.md
- csx.json
- spec.json
- src/lib.rs
- test/contract.rs
Code source
# 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.");
}
Seeder d'origine
anonyme