#io-error #error #io #arc #clone

unmaintained arc-io-error

A version of std::io::Error implemented on top of Arc instead of Box, making it cloneable

2 releases

Uses old Rust 2015

0.1.1 Aug 11, 2017
0.1.0 Aug 10, 2017

#61 in #io-error

MIT/Apache

15KB
161 lines

arc-io-error

This library provides the IoError type, a version of std::io::Error implemented on top of Arc instead of Box, making it cloneable.

Crates.io Linux/OSX Build Status Windows Build Status

Documentation

Usage

First, add this to your Cargo.toml:

[dependencies]
arc-io-error = "0.1.1"

Next, add this to your crate:

extern crate arc_io_error;

use arc_io_error::IoError;

Overview

The API of IoError has been designed to match io::Error, with two exceptions:

IoError implements From for io::Error and vice-versa, so the two types can easily be converted between each other. A type containing io::Error can be made Clone-compatible by instead storing IoError internally and converting from/to io::Error on API boundaries.

Clones derived from the same original IoError instance will share a single heap-allocated error instance (if one is present) using Arc. io::Error instances produced by converting those clones back with the From implementation will also share the same single error instance.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

No runtime deps