Exemple
want 0.3.1
Échantillon vérifié pour cargo want 0.3.1. Le contrat s'est exécuté sur rust 1 · linux alpine/x64 · docker et a réussi : want::new creates a channel pair…
sha256:ba70fd71b980be60ede2ec4e74925e542e4cda0a96e3edb712384520935c0eef
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/want@0.3.1
- Paquets
- Créé
- 2026-09-19T03:30:54Z
Contrat
- want::new creates a channel pair where Giver initially is neither wanting nor canceled
- Taker::want signals interest making Giver::is_wanting true
- Giver::give acknowledges want returning true and resets is_wanting to false
- Taker::cancel marks the channel as canceled making Giver::is_canceled true
- Dropping Taker implicitly cancels the channel making Giver::is_canceled true
- SharedGiver shares wanting and cancellation states and implements Clone
- Giver::poll_want returns Poll::Ready(Ok(())) when wanting and Poll::Ready(Err(_)) when canceled
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-want"
version = "1.0.0"
dependencies = [
"want",
]
[[package]]
name = "try-lock"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
[[package]]
name = "want"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
dependencies = [
"try-lock",
]
[package]
name = "sample-want"
version = "1.0.0"
edition = "2021"
publish = false
[dependencies]
want = "=0.3.1"
[[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/want@0.3.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/want@0.3.1
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:fba624fefd7abc33b5313727804c64587ee2d9c35170000ba71b3d58d193df35","contract":["want::new creates a channel pair where Giver initially is neither wanting nor canceled","Taker::want signals interest making Giver::is_wanting true","Giver::give acknowledges want returning true and resets is_wanting to false","Taker::cancel marks the channel as canceled making Giver::is_canceled true","Dropping Taker implicitly cancels the channel making Giver::is_canceled true","SharedGiver shares wanting and cancellation states and implements Clone","Giver::poll_want returns Poll::Ready(Ok(())) when wanting and Poll::Ready(Err(_)) when canceled"],"goal":"verify pkg:cargo/want@0.3.1","kind":"HOW","packages":["pkg:cargo/want@0.3.1"],"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/want@0.3.1"],"schemaVersion":1,"subject":"pkg:cargo/want@0.3.1","verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify pkg:cargo/want@0.3.1",
"kind": "HOW",
"packages": [
"pkg:cargo/want@0.3.1"
]
}
//! Clean-room verification sample for want.
pub use want::*;
use std::task::{Context, Poll, Waker};
use want::{new, SharedGiver};
fn main() {
// 1. want::new creates a channel pair where Giver initially is neither wanting nor canceled
let (gv, mut tk) = new();
assert!(!gv.is_wanting(), "initial is_wanting should be false");
assert!(!gv.is_canceled(), "initial is_canceled should be false");
// 2. Taker::want signals interest making Giver::is_wanting true
tk.want();
assert!(gv.is_wanting(), "is_wanting should be true after tk.want()");
assert!(!gv.is_canceled(), "is_canceled should remain false after tk.want()");
// 3. Giver::give acknowledges want returning true and resets is_wanting to false
assert!(gv.give(), "give should return true when wanting");
assert!(!gv.is_wanting(), "is_wanting should be false after give");
assert!(!gv.give(), "give should return false when already idle");
// 4. Taker::cancel marks the channel as canceled making Giver::is_canceled true
let (gv2, mut tk2) = new();
assert!(!gv2.is_canceled());
tk2.cancel();
assert!(gv2.is_canceled(), "is_canceled should be true after tk.cancel()");
// 5. Dropping Taker implicitly cancels the channel making Giver::is_canceled true
let (gv3, tk3) = new();
assert!(!gv3.is_canceled());
drop(tk3);
assert!(gv3.is_canceled(), "is_canceled should be true after dropping Taker");
// 6. SharedGiver shares wanting and cancellation states and implements Clone
let (gv4, mut tk4) = new();
let shared: SharedGiver = gv4.shared();
let shared_clone = shared.clone();
assert!(!shared.is_wanting());
assert!(!shared.is_canceled());
assert!(!shared_clone.is_wanting());
assert!(!shared_clone.is_canceled());
tk4.want();
assert!(shared.is_wanting());
assert!(shared_clone.is_wanting());
tk4.cancel();
assert!(shared.is_canceled());
assert!(shared_clone.is_canceled());
// 7. Giver::poll_want returns Poll::Ready(Ok(())) when wanting and Poll::Ready(Err(_)) when canceled
let waker = Waker::noop();
let mut cx = Context::from_waker(&waker);
let (mut gv5, mut tk5) = new();
// Initially not wanting, so poll_want would park (returns Poll::Pending)
assert!(matches!(gv5.poll_want(&mut cx), Poll::Pending));
// When wanting, returns Poll::Ready(Ok(()))
tk5.want();
assert!(matches!(gv5.poll_want(&mut cx), Poll::Ready(Ok(()))));
// When canceled, returns Poll::Ready(Err(_))
let (mut gv6, mut tk6) = new();
tk6.cancel();
assert!(matches!(gv6.poll_want(&mut cx), Poll::Ready(Err(_))));
println!("All want contract assertions passed successfully.");
}
Seeder d'origine
anonyme