Beispiel
dunce 1.0.5: dunce::simplified
Verifiziertes Beispiel für cargo dunce 1.0.5: dunce::simplified. Der Vertrag lief auf rust 1 · linux alpine/x64 · docker und bestand.
sha256:672911efc4b5cda2fe48a9f971c75e670f1ce891cf9f7c9c51d474b2cf51a44e
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
linux · alpine · musl x64 cargo
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| 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 |
Fall
HOW- Ziel
- verify dunce::simplified in pkg:cargo/dunce@1.0.5
- Pakete
- Symbole
-
- dunce::simplified
- Erstellt
- 2026-11-22T00:59:55Z
Contract
- dunce::simplified accepts &Path and returns &Path with the same lifetime without performing filesystem I/O
- dunce::simplified returns empty paths, relative paths, and paths containing . or .. components unmodified
- On non-Windows targets, dunce::simplified is a zero-copy pass-through returning the exact input &Path reference unchanged
- On non-Windows targets, dunce::simplified leaves verbatim UNC-prefixed strings and reserved device-name path strings unmodified
- On Unix targets, dunce::simplified preserves non-UTF-8 OsStr byte paths unchanged without panicking
Dateien
- Cargo.lock
- Cargo.toml
- PROMPT.md
- csx.json
- spec.json
- src/lib.rs
- test/contract.rs
Quelltext
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "dunce"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813"
[[package]]
name = "sample-dunce-simplified"
version = "1.0.0"
dependencies = [
"dunce",
]
[package]
name = "sample-dunce-simplified"
version = "1.0.0"
edition = "2021"
publish = false
[dependencies]
dunce = "=1.0.5"
[[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 dunce::simplified in pkg:cargo/dunce@1.0.5
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/dunce@1.0.5
Demonstrate these symbols/APIs:
- dunce::simplified
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:3118e9caf64d641e290e37a26897e194d42205f3ada5d9f66f2ef2b9ef838f7e","contract":["dunce::simplified accepts \u0026Path and returns \u0026Path with the same lifetime without performing filesystem I/O","dunce::simplified returns empty paths, relative paths, and paths containing . or .. components unmodified","On non-Windows targets, dunce::simplified is a zero-copy pass-through returning the exact input \u0026Path reference unchanged","On non-Windows targets, dunce::simplified leaves verbatim UNC-prefixed strings and reserved device-name path strings unmodified","On Unix targets, dunce::simplified preserves non-UTF-8 OsStr byte paths unchanged without panicking"],"goal":"verify dunce::simplified in pkg:cargo/dunce@1.0.5","kind":"HOW","packages":["pkg:cargo/dunce@1.0.5"],"schemaVersion":1,"symbols":["dunce::simplified"]},"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/dunce@1.0.5"],"schemaVersion":1,"subject":"pkg:cargo/dunce@1.0.5","symbols":["dunce::simplified"],"verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify dunce::simplified in pkg:cargo/dunce@1.0.5",
"kind": "HOW",
"packages": [
"pkg:cargo/dunce@1.0.5"
],
"symbols": [
"dunce::simplified"
]
}
//! Clean-room verification sample for `dunce::simplified`.
pub use dunce::simplified;
use std::path::Path;
fn win_unc_path(drive: char, segments: &[&str]) -> String {
let sep = '\\';
let mut s = format!("{sep}{sep}?{sep}{drive}:");
for seg in segments {
s.push(sep);
s.push_str(seg);
}
s
}
fn win_drive_path(drive: char, segments: &[&str]) -> String {
let sep = '\\';
let mut s = format!("{drive}:");
for seg in segments {
s.push(sep);
s.push_str(seg);
}
s
}
fn main() {
// 1. Exact function signature: fn(&Path) -> &Path, no filesystem I/O required
let simplify_fn: for<'a> fn(&'a Path) -> &'a Path = dunce::simplified;
let nonexistent = Path::new("nonexistent/subdir/example.txt");
assert_eq!(simplify_fn(nonexistent), nonexistent);
// 2. Empty paths, relative paths, and paths containing . or .. components
let empty = Path::new("");
assert_eq!(dunce::simplified(empty), empty);
let relative = Path::new("alpha/beta/gamma.rs");
assert_eq!(dunce::simplified(relative), relative);
let dotted = Path::new("alpha/./beta/../gamma.rs");
assert_eq!(dunce::simplified(dotted), dotted);
let unicode = Path::new("dir/sample_αβγ.txt");
assert_eq!(dunce::simplified(unicode), unicode);
let unc_regular_str = win_unc_path('C', &["example", "file.txt"]);
let unc_reserved_str = win_unc_path('C', &["CON"]);
let unc_dotdot_str = win_unc_path('C', &["example", "..", "file.txt"]);
// 3 & 4. Non-Windows zero-copy pass-through, including verbatim UNC-prefixed strings
#[cfg(not(windows))]
{
let out_rel = dunce::simplified(relative);
assert!(std::ptr::eq(out_rel, relative));
let unc_regular = Path::new(&unc_regular_str);
let out_unc = dunce::simplified(unc_regular);
assert_eq!(out_unc, unc_regular);
assert!(std::ptr::eq(out_unc, unc_regular));
let unc_reserved = Path::new(&unc_reserved_str);
let out_reserved = dunce::simplified(unc_reserved);
assert_eq!(out_reserved, unc_reserved);
assert!(std::ptr::eq(out_reserved, unc_reserved));
let unc_dotdot = Path::new(&unc_dotdot_str);
let out_dotdot = dunce::simplified(unc_dotdot);
assert_eq!(out_dotdot, unc_dotdot);
assert!(std::ptr::eq(out_dotdot, unc_dotdot));
}
// 5. Unix non-UTF-8 OsStr paths are preserved unchanged without panicking
#[cfg(unix)]
{
use std::ffi::OsStr;
use std::os::unix::ffi::OsStrExt;
let raw_bytes = b"dir/non_utf8_\xff_entry";
let non_utf8_path = Path::new(OsStr::from_bytes(raw_bytes));
let out_non_utf8 = dunce::simplified(non_utf8_path);
assert_eq!(out_non_utf8.as_os_str().as_bytes(), raw_bytes);
assert!(std::ptr::eq(out_non_utf8, non_utf8_path));
}
// Cross-platform completeness for Windows targets
#[cfg(windows)]
{
let expected_drive = win_drive_path('C', &["example", "file.txt"]);
assert_eq!(
dunce::simplified(Path::new(&unc_regular_str)),
Path::new(&expected_drive)
);
assert_eq!(
dunce::simplified(Path::new(&unc_reserved_str)),
Path::new(&unc_reserved_str)
);
assert_eq!(
dunce::simplified(Path::new(&unc_dotdot_str)),
Path::new(&unc_dotdot_str)
);
}
#[cfg(not(windows))]
let _ = win_drive_path;
println!("All dunce::simplified contract assertions passed.");
}
Ursprungs-Seeder
anonym