샘플
hyper 1.11.0: hyper
검증된 샘플 — cargo hyper 1.11.0: hyper. rust 1 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: Request builder creates HTTP requests with method, uri, and…
sha256:93b604051424e025b7bbd33a8ac8fff3ce1910e2675f64e592caec480a0a4e31
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
linux · alpine · musl x64 cargo
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| 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 |
케이스
HOW- 목표
- verify hyper in pkg:cargo/hyper@1.11.0
- 패키지
- 심벌
-
- hyper
- 생성일
- 2026-09-20T13:01:39Z
컨트랙트
- 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
파일
- Cargo.lock
- Cargo.toml
- PROMPT.md
- csx.json
- spec.json
- src/lib.rs
- test/contract.rs
소스
# 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.");
}
오리진 시더
익명