Ejemplo
tinyvec 1.12.0: tinyvec::ArrayVec
Muestra verificada para cargo tinyvec 1.12.0: tinyvec::ArrayVec. El contrato se ejecutó en rust 1 · linux alpine/x64 · docker y pasó.
sha256:bdbf45465ce3e490132bbbdb9a9e158d056b9d05822c09a786d290eaf0f8f21b
Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido.
Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas.
MIT-0
Evidencia de ejecución
El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.
- Base de evidencia
- Contrato firmado aprobado
- Recibos de verificación
- 1
- Claves de firma que lo compilaron
- 1
Entorno declarado
linux · alpine · musl x64 cargo
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| 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-11-22 |
Caso
HOW- Objetivo
- verify tinyvec::ArrayVec in pkg:cargo/tinyvec@1.12.0
- Paquetes
- Símbolos
-
- tinyvec::ArrayVec
- Creado
- 2026-11-21T20:39:03Z
Contrato
- ArrayVec::new creates an empty stack-allocated vector with fixed capacity
- push and try_push append elements up to capacity and try_push returns Some(val) when full
- pop, insert, remove, and swap_remove mutate elements while preserving order/invariants
- extend_from_slice, retain, truncate, and clear update length and contents
- from_array_len, From<[T; N]>, split_off, and into_iter construct, split, and consume ArrayVec values
Archivos
- Cargo.lock
- Cargo.toml
- PROMPT.md
- csx.json
- spec.json
- src/lib.rs
- test/contract.rs
Código fuente
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "sample-tinyvec-arrayvec"
version = "0.1.0"
dependencies = [
"tinyvec",
]
[[package]]
name = "tinyvec"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb4ebadaa0af04fab11ae01eb5f9fdb5f9c5b875506e210e71c07873528baa7f"
[package]
name = "sample-tinyvec-arrayvec"
version = "0.1.0"
edition = "2021"
publish = false
[dependencies]
tinyvec = "=1.12.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 tinyvec::ArrayVec in pkg:cargo/tinyvec@1.12.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/tinyvec@1.12.0
Demonstrate these symbols/APIs:
- tinyvec::ArrayVec
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:068d77258f5b34960d6e63f3861b6174086ab838371e8c466b35bed4b57a55d9","contract":["ArrayVec::new creates an empty stack-allocated vector with fixed capacity","push and try_push append elements up to capacity and try_push returns Some(val) when full","pop, insert, remove, and swap_remove mutate elements while preserving order/invariants","extend_from_slice, retain, truncate, and clear update length and contents","from_array_len, From\u003c[T; N]\u003e, split_off, and into_iter construct, split, and consume ArrayVec values"],"goal":"verify tinyvec::ArrayVec in pkg:cargo/tinyvec@1.12.0","kind":"HOW","packages":["pkg:cargo/tinyvec@1.12.0"],"schemaVersion":1,"symbols":["tinyvec::ArrayVec"]},"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/tinyvec@1.12.0"],"schemaVersion":1,"subject":"pkg:cargo/tinyvec@1.12.0","symbols":["tinyvec::ArrayVec"],"verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify tinyvec::ArrayVec in pkg:cargo/tinyvec@1.12.0",
"kind": "HOW",
"packages": [
"pkg:cargo/tinyvec@1.12.0"
],
"symbols": [
"tinyvec::ArrayVec"
]
}
//! Clean-room verification sample for tinyvec::ArrayVec.
pub use tinyvec::ArrayVec;
use tinyvec::ArrayVec;
fn main() {
// 1. ArrayVec::new creates an empty stack-allocated vector with fixed capacity
let mut vec = ArrayVec::<[i32; 4]>::new();
assert!(vec.is_empty());
assert_eq!(vec.len(), 0);
assert_eq!(vec.capacity(), 4);
assert_eq!(vec.as_slice(), &[]);
// 2. push and try_push append elements up to capacity and return overflow on try_push
vec.push(10);
vec.push(20);
assert_eq!(vec.try_push(30), None);
assert_eq!(vec.try_push(40), None);
assert_eq!(vec.len(), 4);
assert_eq!(vec.as_slice(), &[10, 20, 30, 40]);
assert_eq!(vec.try_push(50), Some(50));
assert_eq!(vec.as_slice(), &[10, 20, 30, 40]);
// 3. pop, insert, remove, and swap_remove mutate elements while preserving invariants
assert_eq!(vec.pop(), Some(40));
assert_eq!(vec.as_slice(), &[10, 20, 30]);
vec.insert(1, 15);
assert_eq!(vec.as_slice(), &[10, 15, 20, 30]);
assert_eq!(vec.remove(2), 20);
assert_eq!(vec.as_slice(), &[10, 15, 30]);
assert_eq!(vec.swap_remove(0), 10);
assert_eq!(vec.as_slice(), &[30, 15]);
// 4. retain, truncate, extend_from_slice, and clear update length and contents
vec.extend_from_slice(&[5, 25]);
assert_eq!(vec.as_slice(), &[30, 15, 5, 25]);
vec.retain(|&x| x >= 15);
assert_eq!(vec.as_slice(), &[30, 15, 25]);
vec.truncate(2);
assert_eq!(vec.as_slice(), &[30, 15]);
vec.clear();
assert!(vec.is_empty());
assert_eq!(vec.pop(), None);
// 5. from_array_len, From<[T; N]>, split_off, and into_iter work as expected
let mut from_len = ArrayVec::from_array_len([1, 2, 3, 0, 0], 3);
assert_eq!(from_len.len(), 3);
assert_eq!(from_len.capacity(), 5);
assert_eq!(from_len.as_slice(), &[1, 2, 3]);
let right = from_len.split_off(1);
assert_eq!(from_len.as_slice(), &[1]);
assert_eq!(right.as_slice(), &[2, 3]);
let full = ArrayVec::from([7, 8, 9]);
assert_eq!(full.len(), 3);
let collected: Vec<i32> = full.into_iter().collect();
assert_eq!(collected, vec![7, 8, 9]);
println!("All tinyvec::ArrayVec contract assertions passed.");
}
Seeder de origen
anónimo