Пример
bumpalo 3.20.4
Проверенный пример — cargo bumpalo 3.20.4. Контракт выполнен на rust 1 · linux alpine/x64 · docker и пройден: Bump::new, Bump::alloc, Bump::alloc_with…
sha256:4e93ca5ace199e3b5357590366eee61da96840ff4458efb7ffd6c0df948eb4d3
Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла.
Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди.
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-11-23 |
Кейс
HOW- Цель
- verify pkg:cargo/bumpalo@3.20.4
- Пакеты
- Создан
- 2026-11-23T15:39:22Z
Контракт
- Bump::new, Bump::alloc, Bump::alloc_with, Bump::alloc_str, Bump::alloc_slice_copy, Bump::alloc_slice_clone, Bump::alloc_slice_fill_default, and Bump::alloc_slice_fill_iter allocate mutable arena references and track Bump::allocated_bytes
- Bump::with_capacity and Bump::reset reclaim arena space while retaining at least the existing Bump::chunk_capacity for subsequent allocations
- Bump::set_allocation_limit on a fresh Bump::new arena (0 allocated bytes) allows small Bump::try_alloc calls within the limit and returns Err(AllocErr) when a new chunk would exceed the limit
Файлы
- Cargo.lock
- Cargo.toml
- PROMPT.md
- csx.json
- spec.json
- src/main.rs
- tests/contract.rs
Исходный код
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "bumpalo"
version = "3.20.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87a0cf66fd1eb2fb7b822cb78370d82303750809bc6ba855f3f58e517d3238db"
[[package]]
name = "sample-bumpalo"
version = "0.1.0"
dependencies = [
"bumpalo",
]
[package]
name = "sample-bumpalo"
version = "0.1.0"
edition = "2021"
[dependencies]
bumpalo = "=3.20.4"
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 pkg:cargo/bumpalo@3.20.4
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/bumpalo@3.20.4
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.2
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:bcbc1ebba50286edecb15fc47321f99e1e3143c80ef644b47c1efa59f610c253","contract":["Bump::new, Bump::alloc, Bump::alloc_with, Bump::alloc_str, Bump::alloc_slice_copy, Bump::alloc_slice_clone, Bump::alloc_slice_fill_default, and Bump::alloc_slice_fill_iter allocate mutable arena references and track Bump::allocated_bytes","Bump::with_capacity and Bump::reset reclaim arena space while retaining at least the existing Bump::chunk_capacity for subsequent allocations","Bump::set_allocation_limit on a fresh Bump::new arena (0 allocated bytes) allows small Bump::try_alloc calls within the limit and returns Err(AllocErr) when a new chunk would exceed the limit"],"goal":"verify pkg:cargo/bumpalo@3.20.4","kind":"HOW","packages":["pkg:cargo/bumpalo@3.20.4"],"schemaVersion":1},"contractCommand":["cargo","test","--offline"],"environment":{"arch":"x64","ecosystem":"cargo","os":"linux","packageManager":"cargo","schemaVersion":1},"license":"MIT-0","packages":["pkg:cargo/bumpalo@3.20.4"],"schemaVersion":1,"subject":"pkg:cargo/bumpalo@3.20.4","verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify pkg:cargo/bumpalo@3.20.4",
"kind": "HOW",
"packages": [
"pkg:cargo/bumpalo@3.20.4"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
use bumpalo::Bump;
fn main() {
let mut bump = Bump::with_capacity(256);
let number = bump.alloc(41u32);
*number += 1;
assert_eq!(*number, 42);
let greeting = bump.alloc_str("hello bumpalo");
assert_eq!(greeting, "hello bumpalo");
let copied = bump.alloc_slice_copy(&[10u16, 20, 30]);
copied[1] = 25;
assert_eq!(copied, &[10, 25, 30]);
let cloned = bump.alloc_slice_clone(&[String::from("a"), String::from("b")]);
assert_eq!(cloned, &[String::from("a"), String::from("b")]);
let from_iter = bump.alloc_slice_fill_iter((0u32..4).map(|n| n * n));
assert_eq!(from_iter, &[0, 1, 4, 9]);
let bytes_before_reset = bump.allocated_bytes();
assert!(bytes_before_reset > 0);
bump.reset();
let reused = bump.alloc_with(|| 99u64);
assert_eq!(*reused, 99);
println!("CONTRACT_OK");
}
use bumpalo::Bump;
#[test]
fn alloc_values_strings_and_slices_in_arena() {
let bump = Bump::new();
let value = bump.alloc(123i64);
*value += 7;
assert_eq!(*value, 130);
let computed = bump.alloc_with(|| (10u32, 20u32));
assert_eq!(*computed, (10, 20));
let text = bump.alloc_str("arena-text");
assert_eq!(text, "arena-text");
let slice_copy = bump.alloc_slice_copy(&[1u8, 2, 3, 4]);
slice_copy[0] = 9;
assert_eq!(slice_copy, &[9, 2, 3, 4]);
let slice_clone = bump.alloc_slice_clone(&[String::from("x"), String::from("y")]);
assert_eq!(slice_clone, &[String::from("x"), String::from("y")]);
let slice_default: &mut [u32] = bump.alloc_slice_fill_default(3);
assert_eq!(slice_default, &[0, 0, 0]);
let slice_iter = bump.alloc_slice_fill_iter([2u32, 4, 6]);
assert_eq!(slice_iter, &[2, 4, 6]);
assert!(bump.allocated_bytes() > 0);
}
#[test]
fn reset_reuses_arena_memory_without_freeing_current_chunk() {
let mut bump = Bump::with_capacity(512);
let _first = bump.alloc_slice_fill_copy(64, 7u8);
let cap_before = bump.chunk_capacity();
assert!(cap_before >= 64);
bump.reset();
let cap_after = bump.chunk_capacity();
assert!(cap_after >= cap_before);
let second = bump.alloc_slice_fill_copy(32, 9u8);
assert_eq!(second.len(), 32);
assert!(second.iter().all(|&b| b == 9));
}
#[test]
fn allocation_limit_rejects_oversized_try_alloc() {
let bump = Bump::new();
assert_eq!(bump.allocated_bytes(), 0);
bump.set_allocation_limit(Some(1024));
assert_eq!(bump.allocation_limit(), Some(1024));
let ok_val = bump.try_alloc(42u32).expect("small allocation fits within limit");
assert_eq!(*ok_val, 42);
let too_big = bump.try_alloc([0u8; 4096]);
assert!(too_big.is_err(), "allocation exceeding limit must return Err(AllocErr)");
}
Исходный сидер
аноним