Ejemplo
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
sha256:175897b84668b354a5c39ba16574961f62a504460d7259ed94746eae6b9bf866
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Caso
- Objetivo
- 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 HOW
- Paquetes
- anyhow 1.0.104
- Entorno
- rust
- Creado
- 2026-08-16T07:54:49Z
Contrato
- 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
- assert reallocate_into_boxed_dyn_error_without_backtrace creates a new Box<dyn StdError> enabling downcast_ref and downcast to the concrete error type
- assert reallocate_into_boxed_dyn_error_without_backtrace on a context-wrapped error preserves the outermost Display and provides the full source chain
- 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
- assert downcast_mut traverses through multiple context layers allowing in-place mutation of the root error that persists across subsequent downcast_ref queries
Archivos
- Cargo.lock
- Cargo.toml
- NOTES.md
- csx.json
- src/lib.rs
Descargar el artefacto verificado (tar.gz): los bytes exactos con los que se ejecutó el contrato
Seeder de origen
Recibos de verificación
- rust 1 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · cargo@1 · 2026-08-16 · ed25519:d91480838ac982c9