Beispiel
futures-core 0.3.34: futures_core
Verifiziertes Beispiel für cargo futures-core 0.3.34: futures_core. Der Vertrag lief auf rust 1 · linux alpine/x64 · docker und bestand.
sha256:6951affe55a7f32283b4bc1b34f68caad65af6718f382660df5ce840ef98c0b5
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
linux · alpine · musl x64 cargo
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| 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 |
Fall
HOW- Ziel
- verify futures_core in pkg:cargo/futures-core@0.3.34
- Pakete
- Symbole
-
- futures_core
- Erstellt
- 2026-09-15T22:39:55Z
Contract
- Stream trait implementation emits sequential items and signals completion with None
- FusedStream indicates completion state via is_terminated
- TryFuture blanket implementation enables try_poll on Result-yielding futures
- ready macro extracts value from Poll::Ready or returns early on Poll::Pending
Dateien
- Cargo.lock
- Cargo.toml
- PROMPT.md
- csx.json
- spec.json
- src/lib.rs
- test/contract.rs
Quelltext
# 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 futures_core in pkg:cargo/futures-core@0.3.34
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/futures-core@0.3.34
Demonstrate these symbols/APIs:
- futures_core
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:e432e9f8b84f16ce8008b066218c1dae15eb88c6548cd2eb6a330806a3de3a33","contract":["Stream trait implementation emits sequential items and signals completion with None","FusedStream indicates completion state via is_terminated","TryFuture blanket implementation enables try_poll on Result-yielding futures","ready macro extracts value from Poll::Ready or returns early on Poll::Pending"],"goal":"verify futures_core in pkg:cargo/futures-core@0.3.34","kind":"HOW","packages":["pkg:cargo/futures-core@0.3.34"],"schemaVersion":1,"symbols":["futures_core"]},"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","symbols":["futures_core"],"verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify futures_core in pkg:cargo/futures-core@0.3.34",
"kind": "HOW",
"packages": [
"pkg:cargo/futures-core@0.3.34"
],
"symbols": [
"futures_core"
]
}
//! 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::ready;
use futures_core::stream::{FusedStream, 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))
}
}
impl FusedStream for CounterStream {
fn is_terminated(&self) -> bool {
self.current >= self.limit
}
}
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 test_ready_macro(poll_val: Poll<i32>) -> Poll<i32> {
let val = ready!(poll_val);
Poll::Ready(val * 2)
}
fn main() {
let waker = dummy_waker();
let mut cx = Context::from_waker(&waker);
// 1. Stream trait implementation emits sequential items and signals completion with None
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. FusedStream indicates completion state via is_terminated
let mut fstream = CounterStream::new(1);
assert!(!fstream.is_terminated());
let mut pinned_fstream = Pin::new(&mut fstream);
assert_eq!(pinned_fstream.as_mut().poll_next(&mut cx), Poll::Ready(Some(1)));
assert!(pinned_fstream.is_terminated());
// 3. TryFuture blanket implementation enables try_poll on Result-yielding 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")));
// 4. ready macro extracts value from Poll::Ready or returns early on Poll::Pending
assert_eq!(test_ready_macro(Poll::Ready(21)), Poll::Ready(42));
assert_eq!(test_ready_macro(Poll::Pending), Poll::Pending);
println!("All futures-core contract assertions passed.");
}
Ursprungs-Seeder
anonym