Browse Source

add Currency::all() and Exchange::all() which return a vec of all variants

tags/v0.3.0
Jonathan Strong 4 years ago
parent
commit
cfc2c168c8
1 changed files with 12 additions and 0 deletions
  1. +12
    -0
      src/crypto.rs

+ 12
- 0
src/crypto.rs View File

@@ -198,6 +198,12 @@ macro_rules! make_currency {
other => Err(UnlistedCurrency(other))
}
}

pub fn all() -> Vec<Self> {
vec![
$( c!($ticker) ),*
]
}
}

impl TryFrom<u8> for Currency {
@@ -428,6 +434,12 @@ macro_rules! make_exchange {
),*
}
}

pub fn all() -> Vec<Self> {
vec![
$( e!($ticker) ),*
]
}
}

impl TryFrom<u8> for Exchange {


Loading…
Cancel
Save