Ejemplo
futures-core 0.3.34
Muestra verificada para cargo futures-core 0.3.34. El contrato se ejecutó en rust 1 · linux alpine/x64 · docker y pasó: Stream trait implementation emits…
sha256:d0974288bdb01401176ceb732698adff05d49f357b7a05be8539cb91feb0aa36
Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido.
Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas.
MIT-0
Evidencia de ejecución
El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.
- Base de evidencia
- Contrato firmado aprobado
- Recibos de verificación
- 1
- Claves de firma que lo compilaron
- 1
Entorno declarado
linux · alpine · musl x64 cargo
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| 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-15 |
Caso
HOW- Objetivo
- verify pkg:cargo/futures-core@0.3.34
- Paquetes
- Creado
- 2026-09-15T21:43:29Z
Contrato
- Stream trait implementation emits items and signals completion
- Stream size_hint correctly calculates remaining elements
- TryFuture blanket implementation enables try_poll on Result futures
Archivos
- Cargo.lock
- Cargo.toml
- PROMPT.md
- csx.json
- spec.json
- src/lib.rs
- test/contract.rs
Código fuente
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "futures-core"
version = "0.3.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"
[[package]]
name = "sample-futures-core"
version = "1.0.0"
dependencies = [
"futures-core",
]
[package]
name = "sample-futures-core"
version = "1.0.0"
edition = "2021"
publish = false
[dependencies]
futures-core = "=0.3.34"
[[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/futures-core@0.3.34
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/futures-core@0.3.34
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:679b1619ea7a27408ede048053c8967a38c1c8ee4686ffde1c693e4bbbf37066","contract":["Stream trait implementation emits items and signals completion","Stream size_hint correctly calculates remaining elements","TryFuture blanket implementation enables try_poll on Result futures"],"goal":"verify pkg:cargo/futures-core@0.3.34","kind":"HOW","packages":["pkg:cargo/futures-core@0.3.34"],"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/futures-core@0.3.34"],"schemaVersion":1,"subject":"pkg:cargo/futures-core@0.3.34","verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify pkg:cargo/futures-core@0.3.34",
"kind": "HOW",
"packages": [
"pkg:cargo/futures-core@0.3.34"
]
}
//! Clean-room verification sample for futures-core.
pub use futures_core::*;
use core::pin::Pin;
use core::task::{Context, Poll, RawWaker, RawWakerVTable, Waker};
use futures_core::future::TryFuture;
use futures_core::stream::Stream;
fn dummy_waker() -> Waker {
fn noop(_: *const ()) {}
fn clone(p: *const ()) -> RawWaker {
RawWaker::new(p, &VTABLE)
}
static VTABLE: RawWakerVTable = RawWakerVTable::new(clone, noop, noop, noop);
unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) }
}
struct CounterStream {
current: usize,
limit: usize,
}
impl CounterStream {
fn new(limit: usize) -> Self {
Self { current: 0, limit }
}
}
impl Stream for CounterStream {
type Item = usize;
fn poll_next(mut self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
if self.current < self.limit {
self.current += 1;
Poll::Ready(Some(self.current))
} else {
Poll::Ready(None)
}
}
fn size_hint(&self) -> (usize, Option<usize>) {
let remaining = self.limit - self.current;
(remaining, Some(remaining))
}
}
struct ReadyTryFuture<T, E> {
result: Option<Result<T, E>>,
}
impl<T: Unpin, E: Unpin> core::future::Future for ReadyTryFuture<T, E> {
type Output = Result<T, E>;
fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Self::Output> {
match self.get_mut().result.take() {
Some(res) => Poll::Ready(res),
None => Poll::Pending,
}
}
}
fn main() {
let waker = dummy_waker();
let mut cx = Context::from_waker(&waker);
// 1. Stream trait implementation emits items and signals completion
let mut stream = CounterStream::new(3);
let mut pinned_stream = Pin::new(&mut stream);
assert_eq!(pinned_stream.as_mut().poll_next(&mut cx), Poll::Ready(Some(1)));
assert_eq!(pinned_stream.as_mut().poll_next(&mut cx), Poll::Ready(Some(2)));
assert_eq!(pinned_stream.as_mut().poll_next(&mut cx), Poll::Ready(Some(3)));
assert_eq!(pinned_stream.as_mut().poll_next(&mut cx), Poll::Ready(None));
// 2. Stream size_hint correctly calculates remaining elements
let mut stream2 = CounterStream::new(2);
assert_eq!(stream2.size_hint(), (2, Some(2)));
let mut pinned_stream2 = Pin::new(&mut stream2);
let _ = pinned_stream2.as_mut().poll_next(&mut cx);
assert_eq!(pinned_stream2.size_hint(), (1, Some(1)));
let _ = pinned_stream2.as_mut().poll_next(&mut cx);
assert_eq!(pinned_stream2.size_hint(), (0, Some(0)));
// 3. TryFuture blanket implementation enables try_poll on Result futures
let mut ok_fut = ReadyTryFuture { result: Some(Ok::<i32, &'static str>(42)) };
let mut pinned_ok = Pin::new(&mut ok_fut);
assert_eq!(pinned_ok.as_mut().try_poll(&mut cx), Poll::Ready(Ok(42)));
let mut err_fut = ReadyTryFuture { result: Some(Err::<i32, &'static str>("failed")) };
let mut pinned_err = Pin::new(&mut err_fut);
assert_eq!(pinned_err.as_mut().try_poll(&mut cx), Poll::Ready(Err("failed")));
println!("All futures-core contract assertions passed.");
}
Seeder de origen
anónimo