CodeSampleX

Sample

memchr 2.8.3: memchr

Verified sample for cargo memchr 2.8.3: memchr. The contract ran on rust 1 · linux alpine/x64 · docker and passed: memchr finds first occurrence of a byte in…

sha256:eb7ce95d6f318923186094f9a1e1c07acbcf23a6f806c6ef6bb1153f2de7e291

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-09-14

Case

HOW
Goal
verify memchr in pkg:cargo/memchr@2.8.3
Packages
Symbols
  • memchr
Created
2026-09-14T23:40:22Z

Contract

  1. memchr finds first occurrence of a byte in byte slice
  2. memchr returns None when byte is not found
  3. memchr returns None on empty slice
  4. memchr returns earliest index when byte occurs multiple times

Files

  • Cargo.lock
  • Cargo.toml
  • PROMPT.md
  • csx.json
  • spec.json
  • src/lib.rs
  • test/contract.rs

Download the source artifact (tar.gz)

Source

Cargo.lock
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4

[[package]]
name = "memchr"
version = "2.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"

[[package]]
name = "sample-memchr"
version = "1.0.0"
dependencies = [
 "memchr",
]
Cargo.toml
[package]
name = "sample-memchr"
version = "1.0.0"
edition = "2021"
publish = false

[dependencies]
memchr = "=2.8.3"

[[bin]]
name = "contract"
path = "test/contract.rs"
PROMPT.md
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 memchr in pkg:cargo/memchr@2.8.3
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:cargo/memchr@2.8.3
Demonstrate these symbols/APIs:
  - memchr

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.
csx.json
{"case":{"caseId":"case:sha256:eb5323f41102eac257e405f8d6d5382d5fabfc2a32079be53267a2f989460d8e","contract":["memchr finds first occurrence of a byte in byte slice","memchr returns None when byte is not found","memchr returns None on empty slice","memchr returns earliest index when byte occurs multiple times"],"goal":"verify memchr in pkg:cargo/memchr@2.8.3","kind":"HOW","packages":["pkg:cargo/memchr@2.8.3"],"schemaVersion":1,"symbols":["memchr"]},"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/memchr@2.8.3"],"schemaVersion":1,"subject":"pkg:cargo/memchr@2.8.3","symbols":["memchr"],"verifierAdapter":"cargo@1"}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify memchr in pkg:cargo/memchr@2.8.3",
  "kind": "HOW",
  "packages": [
    "pkg:cargo/memchr@2.8.3"
  ],
  "symbols": [
    "memchr"
  ]
}
src/lib.rs
//! Clean-room verification sample for memchr.

pub use memchr::*;
test/contract.rs
use memchr::memchr;

fn main() {
    let text = b"the quick brown fox jumps over the lazy dog";

    // 1. memchr finds first occurrence of a byte
    assert_eq!(memchr(b'q', text), Some(4));
    assert_eq!(memchr(b'z', text), Some(37));
    assert_eq!(memchr(b'!', text), None);

    // 2. memchr returns None on empty haystack
    assert_eq!(memchr(b'a', b""), None);

    // 3. memchr returns earliest index when byte occurs multiple times
    assert_eq!(memchr(b'e', text), Some(2));

    println!("All memchr contract assertions passed successfully.");
}

Origin Seeder

anonymous