Пример
tracing 0.1.41: tracing::callsite::Identifier
Проверенный пример — cargo tracing 0.1.41: tracing::callsite::Identifier. Контракт выполнен на rust 1 · linux alpine/x64 · docker и пройден.
sha256:ce396c4de6ce5802d588e3fa2c12ce0b1fd162e61d5bc275d8a2b46d8055d2a5
Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла.
Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди.
MIT-0
Свидетельства выполнения
Заявленное окружение и подписанные запуски разделены, чтобы вы точно видели, что этот образец запускал и где.
- Основа свидетельства
- Подписанный контракт пройден
- Квитанции проверки
- 1
- Ключи подписи, собравшие его
- 1
Заявленная среда
linux · musl 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-02 |
Кейс
HOW- Цель
- verify tracing::callsite::Identifier in pkg:cargo/tracing@0.1.41
- Пакеты
- Символы
-
- tracing::callsite::Identifier
- Создан
- 2026-11-02T23:15:40Z
Контракт
- Identifier(&'static dyn Callsite) constructs a callsite identifier from a static Callsite reference
- Identifiers pointing to the same static Callsite compare equal and produce identical hashes
- Identifiers pointing to distinct static Callsites compare unequal
Файлы
- 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 = "once_cell"
version = "1.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
[[package]]
name = "pin-project-lite"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
[[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-tracing-callsite-identifier"
version = "0.1.0"
dependencies = [
"tracing",
]
[[package]]
name = "syn"
version = "2.0.119"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "tracing"
version = "0.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
dependencies = [
"pin-project-lite",
"tracing-attributes",
"tracing-core",
]
[[package]]
name = "tracing-attributes"
version = "0.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "tracing-core"
version = "0.1.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
dependencies = [
"once_cell",
]
[[package]]
name = "unicode-ident"
version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
[package]
name = "sample-tracing-callsite-identifier"
version = "0.1.0"
edition = "2021"
[dependencies]
tracing = "=0.1.41"
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 tracing::callsite::Identifier in pkg:cargo/tracing@0.1.41
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/tracing@0.1.41
Demonstrate these symbols/APIs:
- tracing::callsite::Identifier
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:2a09f401d0bfe2bb1c8943ec1b5cfcbf9426d049cecd66b1697c169dc9265f3a","contract":["Identifier(\u0026'static dyn Callsite) constructs a callsite identifier from a static Callsite reference","Identifiers pointing to the same static Callsite compare equal and produce identical hashes","Identifiers pointing to distinct static Callsites compare unequal"],"goal":"verify tracing::callsite::Identifier in pkg:cargo/tracing@0.1.41","kind":"HOW","packages":["pkg:cargo/tracing@0.1.41"],"schemaVersion":1,"symbols":["tracing::callsite::Identifier"]},"contractCommand":["cargo","test","--offline"],"environment":{"arch":"x64","ecosystem":"cargo","libc":"musl","os":"linux","packageManager":"cargo","schemaVersion":1},"license":"MIT-0","packages":["pkg:cargo/tracing@0.1.41"],"schemaVersion":1,"subject":"pkg:cargo/tracing@0.1.41","symbols":["tracing::callsite::Identifier"],"verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify tracing::callsite::Identifier in pkg:cargo/tracing@0.1.41",
"kind": "HOW",
"packages": [
"pkg:cargo/tracing@0.1.41"
],
"symbols": [
"tracing::callsite::Identifier"
]
}
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
use tracing::callsite::{Callsite, Identifier};
use tracing::subscriber::Interest;
use tracing::Metadata;
struct StaticCallsite(#[allow(dead_code)] u8);
impl Callsite for StaticCallsite {
fn set_interest(&self, _interest: Interest) {}
fn metadata(&self) -> &Metadata<'_> {
unreachable!()
}
}
static CALLSITE_A: StaticCallsite = StaticCallsite(1);
static CALLSITE_B: StaticCallsite = StaticCallsite(2);
fn hash_id(id: &Identifier) -> u64 {
let mut hasher = DefaultHasher::new();
id.hash(&mut hasher);
hasher.finish()
}
pub fn verify_identifiers() {
let id_a1 = Identifier(&CALLSITE_A);
let id_a2 = id_a1.clone();
let id_b = Identifier(&CALLSITE_B);
// Same static callsite gives equal identifiers and identical hashes
assert_eq!(id_a1, id_a2);
assert_eq!(hash_id(&id_a1), hash_id(&id_a2));
// Different non-ZST static callsites have distinct addresses and unequal identifiers
assert_ne!(id_a1, id_b);
// Formatting via Debug works and starts with Identifier(
let debug_str = format!("{:?}", id_a1);
assert!(debug_str.starts_with("Identifier("));
}
fn main() {
verify_identifiers();
}
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
use tracing::callsite::{Callsite, Identifier};
use tracing::subscriber::Interest;
use tracing::Metadata;
struct TestCallsite(#[allow(dead_code)] u8);
impl Callsite for TestCallsite {
fn set_interest(&self, _interest: Interest) {}
fn metadata(&self) -> &Metadata<'_> {
unreachable!()
}
}
static CS_ONE: TestCallsite = TestCallsite(1);
static CS_TWO: TestCallsite = TestCallsite(2);
#[test]
fn contract_callsite_identifier_equality_and_hashing() {
let id_one = Identifier(&CS_ONE);
let id_one_clone = id_one.clone();
let id_two = Identifier(&CS_TWO);
assert_eq!(id_one, id_one_clone);
assert_ne!(id_one, id_two);
let mut h1 = DefaultHasher::new();
id_one.hash(&mut h1);
let mut h2 = DefaultHasher::new();
id_one_clone.hash(&mut h2);
assert_eq!(h1.finish(), h2.finish());
let rendered = format!("{:?}", id_one);
assert!(rendered.starts_with("Identifier("));
}
Исходный сидер
аноним