pub struct TraceableBox(pub Box<dyn TraceableError + Send + Sync + 'static>);Expand description
A concrete, sized encapsulation of a dynamic TraceableError trait object.
This wrapper acts as a type-erased boundary. It enables seamless bidirectional ? operator
compatibility across dynamic crate boundaries, allowing concrete error enums (via thiserror)
and untyped conduits (anyhow) to nest inside each other without losing causal tracing history.
§Example
use traceable_error::{TraceableError, TraceableBox};
fn produce_anyhow() -> anyhow::Result<()> {
Err(anyhow::anyhow!("root failure"))
}
// Seamlessly converts the anyhow::Error into a TraceableBox trait object via ?
fn consume_box() -> Result<(), TraceableBox> {
produce_anyhow()?;
Ok(())
}Tuple Fields§
§0: Box<dyn TraceableError + Send + Sync + 'static>Implementations§
Source§impl TraceableBox
impl TraceableBox
pub fn layer_code(&self) -> String
pub fn chain_codes(&self) -> Vec<String>
pub fn diagnostic_code(&self) -> String
Trait Implementations§
Source§impl Debug for TraceableBox
impl Debug for TraceableBox
Source§impl Display for TraceableBox
impl Display for TraceableBox
Source§impl Error for TraceableBox
impl Error for TraceableBox
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl<E: TraceableError + Send + Sync + 'static> From<E> for TraceableBox
impl<E: TraceableError + Send + Sync + 'static> From<E> for TraceableBox
Auto Trait Implementations§
impl !RefUnwindSafe for TraceableBox
impl !UnwindSafe for TraceableBox
impl Freeze for TraceableBox
impl Send for TraceableBox
impl Sync for TraceableBox
impl Unpin for TraceableBox
impl UnsafeUnpin for TraceableBox
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more