arcerror

Crates.ioarcerror
lib.rsarcerror
created_at2022-10-15 13:47:32.917911
updated_at2024-01-20 19:12:40.179064
descriptionProvides thin wrappers around Arc and Rc where T: Error. Impls Error for both of these types. No unsafe, no dependencies.
homepage
repositoryhttps://gitlab.cronce.io/foss/arcerror
max_upload_size
id688975
Mike Cronce

documentation

README

# arcerror Provides thin wrappers around [`Arc`](https://doc.rust-lang.org/stable/alloc/sync/struct.Arc.html) and [`Rc`](https://doc.rust-lang.org/stable/alloc/rc/struct.Rc.html) where `T`: [`Error`](https://doc.rust-lang.org/stable/core/error/trait.Error.html). Impls `Error` for both of these types. No `unsafe`, no dependencies. The purpose of this is to impl [`Clone`](https://doc.rust-lang.org/stable/core/clone/macro.Clone.html) 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`](https://doc.rust-lang.org/stable/core/result/enum.Result.html); 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`.
Commit count: 0

cargo fmt