Sample
zerocopy 0.8.62: Immutable
Verified sample for cargo zerocopy 0.8.62: Immutable. The contract ran on rust 1 · linux alpine/x64 · docker and passed: zerocopy::Immutable is implemented…
sha256:e313959892eeeeeeba02ba6a0b943862a4fd966190d57240afe0dcac6791fca2
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux · alpine · musl x64 cargo
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| 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-10-16 |
Case
HOW- Goal
- verify Immutable in pkg:cargo/zerocopy@0.8.62
- Packages
- Symbols
-
- Immutable
- Created
- 2026-10-16T16:30:12Z
Contract
- zerocopy::Immutable is implemented for primitive scalar types, arrays, slices, and tuples of Immutable elements
- #[derive(Immutable)] derives zerocopy::Immutable for structs and fieldless enums free of interior mutability
- zerocopy::IntoBytes::as_bytes and zerocopy::FromBytes::ref_from_bytes accept shared references to types satisfying zerocopy::Immutable
- zerocopy::Unalign<T> implements zerocopy::Immutable when T implements zerocopy::Immutable
Files
- Cargo.lock
- Cargo.toml
- PROMPT.md
- csx.json
- spec.json
- src/main.rs
Source
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "proc-macro2"
version = "1.0.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
dependencies = [
"proc-macro2",
]
[[package]]
name = "sample-zerocopy-immutable"
version = "0.1.0"
dependencies = [
"zerocopy",
]
[[package]]
name = "syn"
version = "2.0.119"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "unicode-ident"
version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
[[package]]
name = "zerocopy"
version = "0.8.62"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86502bf56ac7c77571a32e2647bb2a15894565e981fb2a48d7bde2d91c965a9d"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.8.62"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5457206954b06561e2608c7e19cf58b1926586d999c246eebe4502f7e2039d1a"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[package]
name = "sample-zerocopy-immutable"
version = "0.1.0"
edition = "2021"
[dependencies]
zerocopy = { version = "=0.8.62", features = ["derive"] }
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 Immutable in pkg:cargo/zerocopy@0.8.62
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/zerocopy@0.8.62
Demonstrate these symbols/APIs:
- Immutable
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:634800c0aa176cdca136eea8f2d30231049bcaf81d0be4ca29257c7b0f862da0","contract":["zerocopy::Immutable is implemented for primitive scalar types, arrays, slices, and tuples of Immutable elements","#[derive(Immutable)] derives zerocopy::Immutable for structs and fieldless enums free of interior mutability","zerocopy::IntoBytes::as_bytes and zerocopy::FromBytes::ref_from_bytes accept shared references to types satisfying zerocopy::Immutable","zerocopy::Unalign\u003cT\u003e implements zerocopy::Immutable when T implements zerocopy::Immutable"],"goal":"verify Immutable in pkg:cargo/zerocopy@0.8.62","kind":"HOW","packages":["pkg:cargo/zerocopy@0.8.62"],"schemaVersion":1,"symbols":["Immutable"]},"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/zerocopy@0.8.62"],"schemaVersion":1,"subject":"pkg:cargo/zerocopy@0.8.62","symbols":["Immutable"],"verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify Immutable in pkg:cargo/zerocopy@0.8.62",
"kind": "HOW",
"packages": [
"pkg:cargo/zerocopy@0.8.62"
],
"symbols": [
"Immutable"
]
}
use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout, Unalign};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Immutable, IntoBytes, FromBytes, KnownLayout)]
#[repr(C)]
struct PacketHeader {
magic: u16,
length: u16,
}
#[derive(Debug, PartialEq, Eq, Immutable)]
#[repr(u8)]
enum PacketKind {
Data = 1,
Ack = 2,
}
fn require_immutable<T: Immutable + ?Sized>(_val: &T) {}
fn view_bytes<T: Immutable + IntoBytes + ?Sized>(val: &T) -> &[u8] {
val.as_bytes()
}
fn ref_from_shared<T: Immutable + FromBytes + KnownLayout>(bytes: &[u8]) -> Option<&T> {
T::ref_from_bytes(bytes).ok()
}
fn main() {
require_immutable(&42u32);
require_immutable(&[1u8, 2, 3, 4]);
require_immutable(&(10u16, 20u16));
require_immutable(&PacketKind::Data);
require_immutable(&PacketKind::Ack);
let header = PacketHeader {
magic: 0xABCD,
length: 64,
};
require_immutable(&header);
let raw = view_bytes(&header);
assert_eq!(raw.len(), 4);
let decoded: &PacketHeader = ref_from_shared(raw).expect("aligned header bytes");
assert_eq!(decoded, &header);
let unaligned = Unalign::new(header);
require_immutable(&unaligned);
assert_eq!(view_bytes(&unaligned), raw);
}
Origin Seeder
anonymous