Ejemplo
yoke 0.8.2: yoke::Yokeable
Muestra verificada para cargo yoke 0.8.2: yoke::Yokeable. El contrato se ejecutó en rust 1 · linux alpine/x64 · docker y pasó.
sha256:a1c54469b288ed2f8a1aca6fc6ccaf70ea8cd4193c376b30bb69d9d82886f508
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 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-06 |
Caso
HOW- Objetivo
- verify yoke::Yokeable in pkg:cargo/yoke@0.8.2
- Paquetes
- Símbolos
-
- yoke::Yokeable
- Creado
- 2026-11-06T10:28:04Z
Contrato
- #[derive(Yokeable)] implements Yokeable<'a> for structs containing borrowed references and Cow<'a, str>, enabling Yoke::attach_to_cart and Yoke::with_mut.
- <T as Yokeable<'a>>::transform(&'a static_ref) narrows a reference to the 'static projection into &'a <T as Yokeable<'a>>::Output.
- <T as Yokeable<'a>>::transform_owned(static_val) and transform_mut safely project and mutate an owned Yokeable value across narrowed lifetimes.
Archivos
- Cargo.lock
- Cargo.toml
- PROMPT.md
- csx.json
- spec.json
- src/main.rs
Código fuente
# 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-yokeable"
version = "0.1.0"
dependencies = [
"yoke",
]
[[package]]
name = "stable_deref_trait"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
[[package]]
name = "syn"
version = "3.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "synstructure"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "unicode-ident"
version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
[[package]]
name = "yoke"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca"
dependencies = [
"stable_deref_trait",
"yoke-derive",
"zerofrom",
]
[[package]]
name = "yoke-derive"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71"
dependencies = [
"proc-macro2",
"quote",
"syn",
"synstructure",
]
[[package]]
name = "zerofrom"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272"
dependencies = [
"zerofrom-derive",
]
[[package]]
name = "zerofrom-derive"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a"
dependencies = [
"proc-macro2",
"quote",
"syn",
"synstructure",
]
[package]
name = "sample-yokeable"
version = "0.1.0"
edition = "2021"
[dependencies]
yoke = { version = "=0.8.2", 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 yoke::Yokeable in pkg:cargo/yoke@0.8.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/yoke@0.8.2
Demonstrate these symbols/APIs:
- yoke::Yokeable
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:255836850c9cbeb8f5379696640dc58de93095796494ea8c67657cc121fb5443","contract":["#[derive(Yokeable)] implements Yokeable\u003c'a\u003e for structs containing borrowed references and Cow\u003c'a, str\u003e, enabling Yoke::attach_to_cart and Yoke::with_mut.","\u003cT as Yokeable\u003c'a\u003e\u003e::transform(\u0026'a static_ref) narrows a reference to the 'static projection into \u0026'a \u003cT as Yokeable\u003c'a\u003e\u003e::Output.","\u003cT as Yokeable\u003c'a\u003e\u003e::transform_owned(static_val) and transform_mut safely project and mutate an owned Yokeable value across narrowed lifetimes."],"goal":"verify yoke::Yokeable in pkg:cargo/yoke@0.8.2","kind":"HOW","packages":["pkg:cargo/yoke@0.8.2"],"schemaVersion":1,"symbols":["yoke::Yokeable"]},"contractCommand":["cargo","run","--offline"],"environment":{"arch":"x64","ecosystem":"cargo","os":"linux","packageManager":"cargo","schemaVersion":1},"license":"MIT-0","packages":["pkg:cargo/yoke@0.8.2"],"schemaVersion":1,"subject":"pkg:cargo/yoke@0.8.2","symbols":["yoke::Yokeable"],"verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify yoke::Yokeable in pkg:cargo/yoke@0.8.2",
"kind": "HOW",
"packages": [
"pkg:cargo/yoke@0.8.2"
],
"symbols": [
"yoke::Yokeable"
]
}
use std::borrow::Cow;
use yoke::{Yoke, Yokeable};
#[derive(Yokeable, Debug, PartialEq, Eq)]
struct BorrowedHeader<'a> {
name: &'a str,
value: Cow<'a, str>,
}
fn narrow_yokeable<'a, Y>(static_ref: &'a Y) -> &'a <Y as Yokeable<'a>>::Output
where
Y: for<'b> Yokeable<'b>,
{
<Y as Yokeable<'a>>::transform(static_ref)
}
fn narrow_owned<'a, Y>(static_val: Y) -> <Y as Yokeable<'a>>::Output
where
Y: for<'b> Yokeable<'b>,
{
<Y as Yokeable<'a>>::transform_owned(static_val)
}
fn main() {
let backing = String::from("content-type:application/json");
let mut yoked: Yoke<BorrowedHeader<'static>, String> =
Yoke::attach_to_cart(backing, |cart: &str| {
let (name, val) = cart.split_once(':').unwrap();
BorrowedHeader {
name,
value: Cow::Borrowed(val),
}
});
assert_eq!(yoked.get().name, "content-type");
assert_eq!(yoked.get().value, "application/json");
yoked.with_mut(|header| {
header.value = Cow::Owned(format!("{};charset=utf-8", header.value));
});
assert_eq!(yoked.get().value, "application/json;charset=utf-8");
let static_header: BorrowedHeader<'static> = BorrowedHeader {
name: "x-test",
value: Cow::Borrowed("ok"),
};
let narrowed = narrow_yokeable(&static_header);
assert_eq!(narrowed.name, "x-test");
assert_eq!(narrowed.value, "ok");
let mut owned_narrowed = narrow_owned(static_header);
<BorrowedHeader<'static> as Yokeable<'_>>::transform_mut(&mut owned_narrowed, |h| {
h.value = Cow::Owned(format!("{}-mutated", h.value));
});
assert_eq!(owned_narrowed.name, "x-test");
assert_eq!(owned_narrowed.value, "ok-mutated");
}
Seeder de origen
anónimo