Beispiel
hyper 1.11.0: hyper
Verifiziertes Beispiel für cargo hyper 1.11.0: hyper. Der Vertrag lief auf rust 1 · linux alpine/x64 · docker und bestand: Request builder creates HTTP…
sha256:93b604051424e025b7bbd33a8ac8fff3ce1910e2675f64e592caec480a0a4e31
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-20 |
Fall
HOW- Ziel
- verify hyper in pkg:cargo/hyper@1.11.0
- Pakete
- Symbole
-
- hyper
- Erstellt
- 2026-09-20T13:01:39Z
Contract
- Request builder creates HTTP requests with method, uri, and headers
- Response builder creates HTTP responses with status code and headers
- StatusCode checks HTTP status classes and classification
- Method parses standard methods and supports custom method names
- SizeHint calculates upper, lower, and exact body size boundaries
- Frame wraps data chunks and trailer headers
- service_fn wraps a closure into a Service handling requests asynchronously
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 = "bytes"
version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
[[package]]
name = "http"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0"
dependencies = [
"bytes",
"itoa",
]
[[package]]
name = "http-body"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c"
dependencies = [
"bytes",
"http",
]
[[package]]
name = "hyper"
version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d22053281f852e11534f5198498373cbb59295120a20771d90f7ed1897490a72"
dependencies = [
"bytes",
"http",
"http-body",
"tokio",
]
[[package]]
name = "itoa"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
[[package]]
name = "pin-project-lite"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
[[package]]
name = "sample-hyper"
version = "1.0.0"
dependencies = [
"hyper",
]
[[package]]
name = "tokio"
version = "1.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed"
dependencies = [
"pin-project-lite",
]
[package]
name = "sample-hyper"
version = "1.0.0"
edition = "2021"
publish = false
[dependencies]
hyper = "=1.11.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 hyper in pkg:cargo/hyper@1.11.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/hyper@1.11.0
Demonstrate these symbols/APIs:
- hyper
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:3adff5856e43ad361fe787cb83c085c8cb4ab6658a970b42d434309d3f051415","contract":["Request builder creates HTTP requests with method, uri, and headers","Response builder creates HTTP responses with status code and headers","StatusCode checks HTTP status classes and classification","Method parses standard methods and supports custom method names","SizeHint calculates upper, lower, and exact body size boundaries","Frame wraps data chunks and trailer headers","service_fn wraps a closure into a Service handling requests asynchronously"],"goal":"verify hyper in pkg:cargo/hyper@1.11.0","kind":"HOW","packages":["pkg:cargo/hyper@1.11.0"],"schemaVersion":1,"symbols":["hyper"]},"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/hyper@1.11.0"],"schemaVersion":1,"subject":"pkg:cargo/hyper@1.11.0","symbols":["hyper"],"verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify hyper in pkg:cargo/hyper@1.11.0",
"kind": "HOW",
"packages": [
"pkg:cargo/hyper@1.11.0"
],
"symbols": [
"hyper"
]
}
//! Clean-room verification sample for hyper.
pub use hyper::*;
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll, RawWaker, RawWakerVTable, Waker};
use hyper::body::{Body, Bytes, Frame, SizeHint};
use hyper::service::{service_fn, Service};
use hyper::{Method, Request, Response, StatusCode, Version};
struct EmptyBody;
impl Body for EmptyBody {
type Data = Bytes;
type Error = std::convert::Infallible;
fn poll_frame(
self: Pin<&mut Self>,
_cx: &mut Context<'_>,
) -> Poll<Option<Result<Frame<Self::Data>, Self::Error>>> {
Poll::Ready(None)
}
}
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(std::ptr::null(), &VTABLE)) }
}
fn main() {
// 1. Request builder creates HTTP requests with method, uri, and headers
let req = Request::builder()
.method(Method::POST)
.uri("https://example.com/api/v1/resource")
.version(Version::HTTP_11)
.header("content-type", "application/json")
.header("accept", "application/json")
.body(EmptyBody)
.expect("valid request");
assert_eq!(req.method(), Method::POST);
assert_eq!(req.uri().path(), "/api/v1/resource");
assert_eq!(req.version(), Version::HTTP_11);
assert_eq!(
req.headers().get("content-type").unwrap(),
"application/json"
);
// 2. Response builder creates HTTP responses with status code and headers
let res = Response::builder()
.status(StatusCode::CREATED)
.header("x-server-engine", "hyper")
.body(EmptyBody)
.expect("valid response");
assert_eq!(res.status(), StatusCode::CREATED);
assert!(res.status().is_success());
assert_eq!(res.headers().get("x-server-engine").unwrap(), "hyper");
// 3. StatusCode checks HTTP status classes and classification
assert!(StatusCode::OK.is_success());
assert!(StatusCode::MOVED_PERMANENTLY.is_redirection());
assert!(StatusCode::NOT_FOUND.is_client_error());
assert!(StatusCode::INTERNAL_SERVER_ERROR.is_server_error());
assert_eq!(StatusCode::from_u16(404).unwrap(), StatusCode::NOT_FOUND);
// 4. Method parses standard methods and supports custom method names
assert_eq!(Method::GET.as_str(), "GET");
assert_eq!(Method::POST.as_str(), "POST");
let custom_method = Method::from_bytes(b"PURGE").expect("valid custom method");
assert_eq!(custom_method.as_str(), "PURGE");
// 5. SizeHint calculates upper, lower, and exact body size boundaries
let mut hint = SizeHint::new();
hint.set_exact(1024);
assert_eq!(hint.lower(), 1024);
assert_eq!(hint.upper(), Some(1024));
assert_eq!(hint.exact(), Some(1024));
// 6. Frame wraps data chunks and trailer headers
let frame = Frame::data(Bytes::from_static(b"hello hyper"));
assert!(frame.is_data());
assert!(!frame.is_trailers());
assert_eq!(frame.data_ref().unwrap().as_ref(), b"hello hyper");
// 7. service_fn wraps a closure into a Service handling requests asynchronously
let service = service_fn(|req: Request<EmptyBody>| async move {
let status = if req.uri().path() == "/ping" {
StatusCode::OK
} else {
StatusCode::NOT_FOUND
};
Ok::<_, std::convert::Infallible>(
Response::builder()
.status(status)
.body(EmptyBody)
.unwrap(),
)
});
let ping_req = Request::builder()
.uri("/ping")
.body(EmptyBody)
.unwrap();
let mut fut = std::pin::pin!(service.call(ping_req));
let waker = dummy_waker();
let mut cx = Context::from_waker(&waker);
match fut.as_mut().poll(&mut cx) {
Poll::Ready(Ok(resp)) => {
assert_eq!(resp.status(), StatusCode::OK);
}
_ => panic!("service future did not resolve immediately"),
}
println!("All hyper contract assertions passed successfully.");
}
Ursprungs-Seeder
anonym