CodeSampleX

Exemple

anyhow 1.0.104: Convert anyhow::Error to Box<dyn StdError> via into_boxed_dyn_error vs reallocate_into_boxed_dyn_error_without_backtrace to retain downcastability, convert from boxed errors with Error::from_boxed, and mutate root errors through context layers via downcast_mut

Échantillon vérifié pour cargo anyhow 1.0.104: Convert anyhow::Error to Box<dyn StdError> via into_boxed_dyn_error vs…

sha256:175897b84668b354a5c39ba16574961f62a504460d7259ed94746eae6b9bf866

Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré. Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes. MIT-0

Preuves d'exécution

L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.

Base de preuve
Contrat signé réussi
Reçus de vérification
2
Clés de signature qui l’ont compilé
2
Environnement déclaré rust linux x64 rust rust cargo

Environnements des exécutions de vérification

Environnement Contrat Étapes Exécution
rust 1 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · cargo@1
2026-08-16
rust 1 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · cargo@1
2026-08-18

Cas

HOW
Objectif
Convert anyhow::Error to Box<dyn StdError> via into_boxed_dyn_error vs reallocate_into_boxed_dyn_error_without_backtrace to retain downcastability, convert from boxed errors with Error::from_boxed, and mutate root errors through context layers via downcast_mut
Paquets
Symboles
  • anyhow::Error::into_boxed_dyn_error
  • anyhow::Error::reallocate_into_boxed_dyn_error_without_backtrace
  • anyhow::Error::from_boxed
  • anyhow::Error::downcast_mut
  • anyhow::Error::downcast_ref
Environnement
rust
Créé
2026-08-16T07:54:49Z

Contrat

  1. assert into_boxed_dyn_error performs a zero-realloc pointer cast to Box<dyn StdError> whose Display matches but downcast_ref to the inner concrete type returns None
  2. assert reallocate_into_boxed_dyn_error_without_backtrace creates a new Box<dyn StdError> enabling downcast_ref and downcast to the concrete error type
  3. assert reallocate_into_boxed_dyn_error_without_backtrace on a context-wrapped error preserves the outermost Display and provides the full source chain
  4. assert Error::from_boxed converts a Box<dyn StdError> into anyhow::Error where direct downcast to the concrete type returns None but downcasting to Box<dyn StdError> recovers the boxed trait object
  5. assert downcast_mut traverses through multiple context layers allowing in-place mutation of the root error that persists across subsequent downcast_ref queries

Fichiers

  • Cargo.lock
  • Cargo.toml
  • NOTES.md
  • csx.json
  • src/lib.rs

Télécharger l’artefact source (tar.gz)

Seeder d'origine

csx-seed