don't export private macro

This commit is contained in:
Jordan Petridis 2019-03-30 17:08:28 +02:00
parent 644ca7d0d0
commit 32ecb05902
No known key found for this signature in database
GPG Key ID: E8523968931763BE
3 changed files with 15 additions and 2 deletions

View File

@ -91,7 +91,6 @@ pub enum DataError {
} }
// Maps a type to a variant of the DataError enum // Maps a type to a variant of the DataError enum
#[macro_export]
macro_rules! easy_from_impl { macro_rules! easy_from_impl {
($outer_type:ty, $from:ty => $to:expr) => ( ($outer_type:ty, $from:ty => $to:expr) => (
impl From<$from> for $outer_type { impl From<$from> for $outer_type {

View File

@ -44,6 +44,21 @@ pub enum DownloadError {
InvalidCachedImageLocation, InvalidCachedImageLocation,
} }
// Maps a type to a variant of the DataError enum
macro_rules! easy_from_impl {
($outer_type:ty, $from:ty => $to:expr) => (
impl From<$from> for $outer_type {
fn from(err: $from) -> Self {
$to(err)
}
}
);
($outer_type:ty, $from:ty => $to:expr, $($f:ty => $t:expr),+) => (
easy_from_impl!($outer_type, $from => $to);
easy_from_impl!($outer_type, $($f => $t),+);
);
}
easy_from_impl!( easy_from_impl!(
DownloadError, DownloadError,
reqwest::Error => DownloadError::RequestError, reqwest::Error => DownloadError::RequestError,

View File

@ -53,7 +53,6 @@ extern crate pretty_assertions;
extern crate glob; extern crate glob;
extern crate mime_guess; extern crate mime_guess;
#[macro_use]
extern crate podcasts_data; extern crate podcasts_data;
extern crate reqwest; extern crate reqwest;
extern crate tempdir; extern crate tempdir;