1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//! Provides thin wrappers around [`Arc<T>`](std::sync::Arc) and [`Rc<T>`](std::rc::Rc) where `T`:
//! [`Error`](::core::error::Error).  Impls `Error` for both of these types.  No `unsafe`, no
//! dependencies.
//!
//! The purpose of this is to impl [`Clone`] for arbitrary `Error` types that don't already have
//! such an implementation.  The use case that drove it was for an HTTP server that was making an
//! HTTP request for large files through a third-party wrapper around an API, and streaming the
//! response to both a File on the local filesystem and to our own HTTP response concurrently,
//! through a broadcast channel.
//!
//! A network stream can fail at any time, so every "chunk" is returned in a [`Result`]; the
//! third-party wrapper crate didn't impl `Clone` on its error type (and many of the errors it was)
//! wrapping also don't impl `Clone`).  This is a solution to making that `Result` impl `Clone`.

mod arc;
mod rc;
pub use arc::ArcError;
pub use rc::RcError;