Exemple
zerovec 0.11.6: zerovec::ule::CharULE
Échantillon vérifié pour cargo zerovec 0.11.6: zerovec::ule::CharULE. Le contrat s'est exécuté sur rust 1 · linux alpine/x64 · docker et a réussi.
sha256:cebd8b3a34c0864676df311621f7cfdb8cbddbe780f5a381036718a6304800e2
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-21 |
Cas
HOW- Objectif
- verify zerovec::ule::CharULE in pkg:cargo/zerovec@0.11.6
- Paquets
- Symboles
-
- zerovec::ule::CharULE
- Créé
- 2026-09-21T12:36:50Z
Contrat
- CharULE converts to and from char directly and via AsULE trait
- CharULE encodes characters as 3 little-endian bytes without padding
- CharULE parses and validates byte slices rejecting non-multiple of 3 lengths and invalid codepoints
- CharULE preserves character equality and ordering semantics
- ZeroVec stores characters as unaligned CharULE elements
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 = "sample-zerovec"
version = "1.0.0"
dependencies = [
"zerovec",
]
[[package]]
name = "zerofrom"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272"
[[package]]
name = "zerovec"
version = "0.11.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239"
dependencies = [
"zerofrom",
]
[package]
name = "sample-zerovec"
version = "1.0.0"
edition = "2021"
publish = false
[dependencies]
zerovec = "=0.11.6"
[[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 zerovec::ule::CharULE in pkg:cargo/zerovec@0.11.6
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/zerovec@0.11.6
Demonstrate these symbols/APIs:
- zerovec::ule::CharULE
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:57cf464e14a2aab3162ac0e80051512802bdeed00292ccb514b2acd97d3b657c","contract":["CharULE converts to and from char directly and via AsULE trait","CharULE encodes characters as 3 little-endian bytes without padding","CharULE parses and validates byte slices rejecting non-multiple of 3 lengths and invalid codepoints","CharULE preserves character equality and ordering semantics","ZeroVec stores characters as unaligned CharULE elements"],"goal":"verify zerovec::ule::CharULE in pkg:cargo/zerovec@0.11.6","kind":"HOW","packages":["pkg:cargo/zerovec@0.11.6"],"schemaVersion":1,"symbols":["zerovec::ule::CharULE"]},"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/zerovec@0.11.6"],"schemaVersion":1,"subject":"pkg:cargo/zerovec@0.11.6","symbols":["zerovec::ule::CharULE"],"verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify zerovec::ule::CharULE in pkg:cargo/zerovec@0.11.6",
"kind": "HOW",
"packages": [
"pkg:cargo/zerovec@0.11.6"
],
"symbols": [
"zerovec::ule::CharULE"
]
}
//! Clean-room verification sample for zerovec.
pub use zerovec::*;
use std::cmp::Ordering;
use zerovec::ule::{AsULE, CharULE, ULE};
use zerovec::ZeroVec;
fn main() {
// 1. CharULE converts to and from char directly and via AsULE trait
let c = '🦀';
let ule_direct = CharULE::from_aligned(c);
assert_eq!(ule_direct.to_char(), c);
let ule_trait: CharULE = c.to_unaligned();
assert_eq!(char::from_unaligned(ule_trait), c);
assert_eq!(ule_direct, ule_trait);
let chars = ['a', 'Ω', '文', '🦀'];
for &ch in &chars {
let ule = ch.to_unaligned();
assert_eq!(char::from_unaligned(ule), ch);
assert_eq!(ule.to_char(), ch);
}
// 2. CharULE encodes characters as 3 little-endian bytes without padding
let ascii_slice = ['a'.to_unaligned()];
let ascii_bytes = CharULE::slice_as_bytes(&ascii_slice);
assert_eq!(ascii_bytes, &[0x61, 0x00, 0x00]);
// Crab emoji U+1F980 -> LE bytes: 0x80, 0xF9, 0x01
let crab_slice = ['🦀'.to_unaligned()];
let crab_bytes = CharULE::slice_as_bytes(&crab_slice);
assert_eq!(crab_bytes, &[0x80, 0xF9, 0x01]);
const ARRAY_CHARS: [char; 2] = ['a', 'b'];
const ARRAY_ULES: [CharULE; 2] = CharULE::from_array(ARRAY_CHARS);
assert_eq!(CharULE::slice_as_bytes(&ARRAY_ULES), &[0x61, 0x00, 0x00, 0x62, 0x00, 0x00]);
// 3. CharULE parses and validates byte slices rejecting non-multiple of 3 lengths and invalid codepoints
let valid_bytes = [0x61, 0x00, 0x00, 0x80, 0xF9, 0x01];
let parsed = CharULE::parse_bytes_to_slice(&valid_bytes).expect("valid bytes");
assert_eq!(parsed.len(), 2);
assert_eq!(parsed[0].to_char(), 'a');
assert_eq!(parsed[1].to_char(), '🦀');
// Length not multiple of 3
assert!(CharULE::parse_bytes_to_slice(&[0x61, 0x00]).is_err());
assert!(CharULE::validate_bytes(&[0x61, 0x00]).is_err());
// Surrogate codepoint 0xD800 (high surrogate) -> LE: 0x00, 0xD8, 0x00
let surrogate_bytes = [0x00, 0xD8, 0x00];
assert!(CharULE::parse_bytes_to_slice(&surrogate_bytes).is_err());
assert!(CharULE::validate_bytes(&surrogate_bytes).is_err());
// Out of range codepoint 0x20FFFF -> LE: 0xFF, 0xFF, 0x20
let out_of_range = [0xFF, 0xFF, 0x20];
assert!(CharULE::parse_bytes_to_slice(&out_of_range).is_err());
assert!(CharULE::validate_bytes(&out_of_range).is_err());
// 4. CharULE preserves character equality and ordering semantics
let ule_a = 'a'.to_unaligned();
let ule_b = 'b'.to_unaligned();
let ule_a2 = 'a'.to_unaligned();
assert_eq!(ule_a, ule_a2);
assert_ne!(ule_a, ule_b);
assert_eq!(ule_a.cmp(&ule_b), Ordering::Less);
assert_eq!(ule_b.cmp(&ule_a), Ordering::Greater);
assert_eq!(ule_a.cmp(&ule_a2), Ordering::Equal);
assert!(ule_a < ule_b);
// 5. ZeroVec stores characters as unaligned CharULE elements
let zv = ZeroVec::<char>::parse_bytes(&valid_bytes).expect("valid zerovec bytes");
assert_eq!(zv.get(0), Some('a'));
assert_eq!(zv.get(1), Some('🦀'));
assert_eq!(zv.get(2), None);
assert_eq!(zv.as_bytes(), &valid_bytes);
let zv_borrowed: ZeroVec<char> = ZeroVec::new_borrowed(&ARRAY_ULES);
assert_eq!(zv_borrowed.get(0), Some('a'));
assert_eq!(zv_borrowed.get(1), Some('b'));
assert_eq!(zv_borrowed.get(2), None);
println!("All zerovec::ule::CharULE contract assertions passed successfully.");
}
Seeder d'origine
anonyme