Exemplo
socket2 0.6.5: socket2::Type
Amostra verificada para cargo socket2 0.6.5: socket2::Type. O contrato rodou em rust 1 · linux alpine/x64 · docker e passou: Type::STREAM and Type::DGRAM…
sha256:886656c0294e551e0017e6ea94296a91bf45b1f465659c0cd4c8a275c6849fbf
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
linux · alpine · musl x64 cargo
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| 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 |
Caso
HOW- Objetivo
- verify socket2::Type in pkg:cargo/socket2@0.6.5
- Pacotes
- Símbolos
-
- socket2::Type
- Criado
- 2026-09-20T16:27:44Z
Contrato
- Type::STREAM and Type::DGRAM provide distinct standard socket type constants
- Type::SEQPACKET, Type::RAW, and Type::DCCP provide extended socket types
- Type::nonblocking and Type::cloexec modify socket type flags
- Type converts to and from raw integer representation using From and Into
- Type supports Copy, Clone, and equality comparisons
Arquivos
- Cargo.lock
- Cargo.toml
- PROMPT.md
- csx.json
- spec.json
- src/lib.rs
- test/contract.rs
Código-fonte
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "libc"
version = "0.2.189"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
[[package]]
name = "sample-socket2"
version = "1.0.0"
dependencies = [
"socket2",
]
[[package]]
name = "socket2"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"
dependencies = [
"libc",
"windows-sys",
]
[[package]]
name = "windows-link"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
[[package]]
name = "windows-sys"
version = "0.61.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
dependencies = [
"windows-link",
]
[package]
name = "sample-socket2"
version = "1.0.0"
edition = "2021"
publish = false
[dependencies]
socket2 = { version = "=0.6.5", features = ["all"] }
[[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 socket2::Type in pkg:cargo/socket2@0.6.5
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/socket2@0.6.5
Demonstrate these symbols/APIs:
- socket2::Type
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:2f72509819a814ead549af3b29bd005548398d6efd41283d86dadee2a6db8a75","contract":["Type::STREAM and Type::DGRAM provide distinct standard socket type constants","Type::SEQPACKET, Type::RAW, and Type::DCCP provide extended socket types","Type::nonblocking and Type::cloexec modify socket type flags","Type converts to and from raw integer representation using From and Into","Type supports Copy, Clone, and equality comparisons"],"goal":"verify socket2::Type in pkg:cargo/socket2@0.6.5","kind":"HOW","packages":["pkg:cargo/socket2@0.6.5"],"schemaVersion":1,"symbols":["socket2::Type"]},"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/socket2@0.6.5"],"schemaVersion":1,"subject":"pkg:cargo/socket2@0.6.5","symbols":["socket2::Type"],"verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify socket2::Type in pkg:cargo/socket2@0.6.5",
"kind": "HOW",
"packages": [
"pkg:cargo/socket2@0.6.5"
],
"symbols": [
"socket2::Type"
]
}
//! Clean-room verification sample for socket2.
pub use socket2::*;
use socket2::Type;
fn main() {
// 1. Type::STREAM and Type::DGRAM provide distinct standard socket type constants
let stream = Type::STREAM;
let dgram = Type::DGRAM;
assert_eq!(stream, Type::STREAM);
assert_ne!(stream, dgram);
// 2. Type::SEQPACKET, Type::RAW, and Type::DCCP provide extended socket types
let seqpacket = Type::SEQPACKET;
let raw = Type::RAW;
let dccp = Type::DCCP;
assert_ne!(stream, seqpacket);
assert_ne!(stream, raw);
assert_ne!(stream, dccp);
// 3. Type::nonblocking and Type::cloexec modify socket type flags
let stream_nb = stream.nonblocking();
let stream_cloexec = stream.cloexec();
let stream_both = stream.nonblocking().cloexec();
assert_ne!(stream, stream_nb);
assert_ne!(stream, stream_cloexec);
assert_ne!(stream_nb, stream_both);
// 4. Type converts to and from raw integer representation using From and Into
let raw_int: std::ffi::c_int = stream.into();
let reconstructed = Type::from(raw_int);
assert_eq!(stream, reconstructed);
let raw_int_dgram: std::ffi::c_int = dgram.into();
let reconstructed_dgram = Type::from(raw_int_dgram);
assert_eq!(dgram, reconstructed_dgram);
// 5. Type supports Copy, Clone, and equality comparisons
let copy_type = stream;
assert_eq!(copy_type, stream);
println!("All socket2::Type contract assertions passed successfully.");
}
Seeder de origem
anônimo