arcerror 0.1.5

Provides thin wrappers around Arc<T> and Rc<T> where T: Error. Impls Error for both of these types. No unsafe, no dependencies.
Documentation
use std::error::Error;
use std::fmt;
use std::ops::Deref;
use std::sync::Arc;

/// A thin wrapper around [`Arc`] to provide [`Clone`] to error types that don't already impl
/// Clone, while maintaining [`Send`] + [`Sync`]
pub struct ArcError<T: Error>(Arc<T>);

impl<T: Error> AsRef<T> for ArcError<T> {
	#[inline]
	fn as_ref(&self) -> &T {
		self.0.as_ref()
	}
}

impl<T: Error> fmt::Display for ArcError<T> {
	#[inline]
	fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
		<T as fmt::Display>::fmt(self.0.as_ref(), f)
	}
}

impl<T: Error> fmt::Debug for ArcError<T> {
	#[inline]
	fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
		<T as fmt::Debug>::fmt(self.0.as_ref(), f)
	}
}

impl<T: Error> Error for ArcError<T> {}

impl<T: Error> From<T> for ArcError<T> {
	#[inline]
	fn from(inner: T) -> Self {
		Self(Arc::new(inner))
	}
}

impl<T: Error> Clone for ArcError<T> {
	#[inline]
	fn clone(&self) -> Self {
		Self(self.0.clone())
	}
}

impl<T: Error> Deref for ArcError<T> {
	type Target = T;
	#[inline]
	fn deref(&self) -> &Self::Target {
		self.0.deref()
	}
}