샘플
http-body 1.1.0
검증된 샘플 — cargo http-body 1.1.0. rust 1 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: Frame encapsulates body data frames with inspection and…
sha256:27f921d5989aa4da60094a1e134e69d872bd014e8cd844bbdddcd0c3ace8ba81
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
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-16 |
케이스
HOW- 목표
- verify pkg:cargo/http-body@1.1.0
- 패키지
- 생성일
- 2026-09-16T10:50:36Z
컨트랙트
- Frame encapsulates body data frames with inspection and transformation capabilities
- SizeHint computes lower, upper, and exact bounds and supports addition
- Body trait streams data frames and signals completion on String instances
- Body trait is implemented for Boxed and mutable reference body wrappers
파일
- 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 = "itoa"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
[[package]]
name = "sample-http-body"
version = "1.0.0"
dependencies = [
"http-body",
]
[package]
name = "sample-http-body"
version = "1.0.0"
edition = "2021"
publish = false
[dependencies]
http-body = "=1.1.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 pkg:cargo/http-body@1.1.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/http-body@1.1.0
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:a345483312a22493333d0588232ed788676f93d795bf3d2c7a8e1676e1888871","contract":["Frame encapsulates body data frames with inspection and transformation capabilities","SizeHint computes lower, upper, and exact bounds and supports addition","Body trait streams data frames and signals completion on String instances","Body trait is implemented for Boxed and mutable reference body wrappers"],"goal":"verify pkg:cargo/http-body@1.1.0","kind":"HOW","packages":["pkg:cargo/http-body@1.1.0"],"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/http-body@1.1.0"],"schemaVersion":1,"subject":"pkg:cargo/http-body@1.1.0","verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify pkg:cargo/http-body@1.1.0",
"kind": "HOW",
"packages": [
"pkg:cargo/http-body@1.1.0"
]
}
//! Clean-room verification sample for http-body.
pub use http_body::*;
use http_body::{Body, Frame, SizeHint};
use std::pin::Pin;
use std::task::{Context, Poll, RawWaker, RawWakerVTable, Waker};
static DUMMY_VTABLE: RawWakerVTable = RawWakerVTable::new(
|_| RawWaker::new(std::ptr::null(), &DUMMY_VTABLE),
|_| {},
|_| {},
|_| {},
);
fn dummy_context() -> (Waker, Context<'static>) {
let raw = RawWaker::new(std::ptr::null(), &DUMMY_VTABLE);
let waker = unsafe { Waker::from_raw(raw) };
let cx = Context::from_waker(unsafe { &*(&waker as *const Waker) });
(waker, cx)
}
fn main() {
let (_waker, mut cx) = dummy_context();
// 1. Frame encapsulates body data frames with inspection and transformation capabilities
let data_frame = Frame::data("contract payload");
assert!(data_frame.is_data());
assert!(!data_frame.is_trailers());
assert_eq!(data_frame.data_ref(), Some(&"contract payload"));
let mapped = data_frame.map_data(|s| s.len());
assert!(mapped.is_data());
assert_eq!(mapped.into_data().ok(), Some(16));
// 2. SizeHint computes lower, upper, and exact bounds and supports addition
let default_hint = SizeHint::default();
assert_eq!(default_hint.lower(), 0);
assert_eq!(default_hint.upper(), None);
assert_eq!(default_hint.exact(), None);
let exact_hint = SizeHint::with_exact(1024);
assert_eq!(exact_hint.lower(), 1024);
assert_eq!(exact_hint.upper(), Some(1024));
assert_eq!(exact_hint.exact(), Some(1024));
let mut range_hint = SizeHint::new();
range_hint.set_lower(100);
range_hint.set_upper(500);
assert_eq!(range_hint.lower(), 100);
assert_eq!(range_hint.upper(), Some(500));
assert_eq!(range_hint.exact(), None);
let sum_hint = exact_hint + range_hint;
assert_eq!(sum_hint.lower(), 1124);
assert_eq!(sum_hint.upper(), Some(1524));
assert_eq!(sum_hint.exact(), None);
// 3. Body trait streams data frames and signals completion on String instances
let mut string_body = String::from("stream chunk");
assert_eq!(string_body.size_hint().exact(), Some(12));
assert!(!string_body.is_end_stream());
let first_poll = Pin::new(&mut string_body).poll_frame(&mut cx);
match first_poll {
Poll::Ready(Some(Ok(frame))) => {
assert!(frame.is_data());
let data = frame.into_data().ok().expect("valid data frame");
assert_eq!(&data[..], b"stream chunk");
}
other => panic!("expected Ready(Some(Ok(frame))), got {:?}", other),
}
assert!(string_body.is_end_stream());
let second_poll = Pin::new(&mut string_body).poll_frame(&mut cx);
assert!(matches!(second_poll, Poll::Ready(None)));
// 4. Body trait is implemented for Boxed and mutable reference body wrappers
let mut boxed_body: Box<String> = Box::new(String::from("boxed payload"));
assert_eq!(boxed_body.size_hint().exact(), Some(13));
assert!(!boxed_body.is_end_stream());
let mut ref_body = &mut boxed_body;
let poll_ref = Pin::new(&mut ref_body).poll_frame(&mut cx);
match poll_ref {
Poll::Ready(Some(Ok(frame))) => {
assert!(frame.is_data());
let data = frame.into_data().ok().expect("valid data frame");
assert_eq!(&data[..], b"boxed payload");
}
other => panic!("expected Ready(Some(Ok(frame))), got {:?}", other),
}
assert!(ref_body.is_end_stream());
println!("All http-body contract assertions passed.");
}
오리진 시더
익명