示例
miniz_oxide 0.8.9: miniz_oxide::deflate::CompressionLevel
已验证示例 — cargo miniz_oxide 0.8.9: miniz_oxide::deflate::CompressionLevel. contract 在 rust 1 · linux alpine/x64 · docker 上运行并通过.
sha256:3e243fe6715cbf27f09c56d57040ca0fdc6daf3a4ac147ca1cbae75ac2e258c6
本网络只提供一件事:能构建的样本。它在沙箱中运行并保留签名回执。它不评级、不担保——同样的代码能否在你的环境构建,它没有测量过。
提交了通过的契约回执的不同签名密钥数量。为 1 表示只有作者;大于 1 表示还有其他人构建过。密钥是自行生成的,背后没有注册身份,因此计的是密钥而非人。
MIT-0
执行证据
声明的环境与签名的运行分开呈现,你可以看到这个样本究竟运行了什么、在哪里运行。
- 证据依据
- 签名契约通过
- 验证回执
- 1
- 构建过它的签名密钥
- 1
声明的环境
linux 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 miniz_oxide::deflate::CompressionLevel in pkg:cargo/miniz_oxide@0.8.9
- 符号
-
- miniz_oxide::deflate::CompressionLevel
- 创建时间
- 2026-09-20T19:58:38Z
契约
- CompressionLevel variants map to expected integer deflate levels including NoCompression, BestSpeed, DefaultLevel, BestCompression, and UberCompression
- CompressionLevel supports Debug formatting and standard equality comparisons
- CompressionLevel supports cloning, copy semantics, and hashing for collection storage
- CompressorOxide accepts CompressionLevel configuration via set_compression_level
- Data compressed with CompressionLevel round-trips through decompress_to_vec back to the original bytes
文件
- 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 = "adler2"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
[[package]]
name = "miniz_oxide"
version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
dependencies = [
"adler2",
]
[[package]]
name = "sample-miniz-oxide"
version = "1.0.0"
dependencies = [
"miniz_oxide",
]
[package]
name = "sample-miniz-oxide"
version = "1.0.0"
edition = "2021"
publish = false
[dependencies]
miniz_oxide = "=0.8.9"
[[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 miniz_oxide::deflate::CompressionLevel in pkg:cargo/miniz_oxide@0.8.9
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/miniz_oxide@0.8.9
Demonstrate these symbols/APIs:
- miniz_oxide::deflate::CompressionLevel
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:71e8fd6c4f798f1c0437e30d5153ece5560839a9203942f05c2a2fb61d3ab5bb","contract":["CompressionLevel variants map to expected integer deflate levels including NoCompression, BestSpeed, DefaultLevel, BestCompression, and UberCompression","CompressionLevel supports Debug formatting and standard equality comparisons","CompressionLevel supports cloning, copy semantics, and hashing for collection storage","CompressorOxide accepts CompressionLevel configuration via set_compression_level","Data compressed with CompressionLevel round-trips through decompress_to_vec back to the original bytes"],"goal":"verify miniz_oxide::deflate::CompressionLevel in pkg:cargo/miniz_oxide@0.8.9","kind":"HOW","packages":["pkg:cargo/miniz_oxide@0.8.9"],"schemaVersion":1,"symbols":["miniz_oxide::deflate::CompressionLevel"]},"contractCommand":["cargo","run","--offline"],"environment":{"arch":"x64","ecosystem":"cargo","os":"linux","packageManager":"cargo","schemaVersion":1},"license":"MIT-0","packages":["pkg:cargo/miniz_oxide@0.8.9"],"schemaVersion":1,"subject":"pkg:cargo/miniz_oxide@0.8.9","symbols":["miniz_oxide::deflate::CompressionLevel"],"verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify miniz_oxide::deflate::CompressionLevel in pkg:cargo/miniz_oxide@0.8.9",
"kind": "HOW",
"packages": [
"pkg:cargo/miniz_oxide@0.8.9"
],
"symbols": [
"miniz_oxide::deflate::CompressionLevel"
]
}
//! Clean-room verification sample for miniz_oxide.
pub use miniz_oxide::*;
use miniz_oxide::deflate::core::CompressorOxide;
use miniz_oxide::deflate::{compress_to_vec, CompressionLevel};
use miniz_oxide::inflate::decompress_to_vec;
use std::collections::HashSet;
fn main() {
// 1. CompressionLevel variants map to expected integer deflate levels including NoCompression, BestSpeed, DefaultLevel, BestCompression, and UberCompression
assert_eq!(CompressionLevel::NoCompression as i32, 0);
assert_eq!(CompressionLevel::BestSpeed as i32, 1);
assert_eq!(CompressionLevel::DefaultLevel as i32, 6);
assert_eq!(CompressionLevel::BestCompression as i32, 9);
assert_eq!(CompressionLevel::UberCompression as i32, 10);
assert_eq!(CompressionLevel::DefaultCompression as i32, -1);
// 2. CompressionLevel supports Debug formatting and standard equality comparisons
assert_eq!(format!("{:?}", CompressionLevel::BestSpeed), "BestSpeed");
assert_eq!(format!("{:?}", CompressionLevel::NoCompression), "NoCompression");
assert_eq!(CompressionLevel::BestSpeed, CompressionLevel::BestSpeed);
assert_ne!(CompressionLevel::BestSpeed, CompressionLevel::BestCompression);
// 3. CompressionLevel supports cloning, copy semantics, and hashing for collection storage
let level_copy = CompressionLevel::DefaultLevel;
let mut level_set = HashSet::new();
level_set.insert(level_copy);
level_set.insert(CompressionLevel::DefaultLevel);
level_set.insert(CompressionLevel::UberCompression);
assert_eq!(level_set.len(), 2);
assert!(level_set.contains(&level_copy));
// 4. CompressorOxide accepts CompressionLevel configuration via set_compression_level
let mut compressor = CompressorOxide::default();
compressor.set_compression_level(CompressionLevel::BestSpeed);
compressor.set_compression_level(CompressionLevel::BestCompression);
compressor.set_compression_level(CompressionLevel::NoCompression);
// 5. Data compressed with CompressionLevel round-trips through decompress_to_vec back to the original bytes
let payload = b"miniz_oxide clean-room contract verification test for CompressionLevel. Data repetition test 1234567890 1234567890.";
let levels = [
CompressionLevel::NoCompression,
CompressionLevel::BestSpeed,
CompressionLevel::DefaultLevel,
CompressionLevel::BestCompression,
CompressionLevel::UberCompression,
];
for level in levels {
let compressed = compress_to_vec(payload, level as u8);
let decompressed = decompress_to_vec(&compressed).expect("decompression succeeds");
assert_eq!(decompressed, payload);
}
// Verify compression ratio differences between NoCompression and BestCompression
let compressed_none = compress_to_vec(payload, CompressionLevel::NoCompression as u8);
let compressed_best = compress_to_vec(payload, CompressionLevel::BestCompression as u8);
assert!(compressed_best.len() < compressed_none.len());
println!("All miniz_oxide::deflate::CompressionLevel contract assertions passed successfully.");
}
原始种子者
匿名