diff options
| author | Austin Hellyer <[email protected]> | 2016-11-29 20:51:10 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-29 22:27:59 -0800 |
| commit | 93b990d8d1bc9df69b8e27a3db61da570822aad6 (patch) | |
| tree | 6305cf635df90681527a8e736f65ff19f21fd8bc /src/utils/mod.rs | |
| parent | Add more shiny readme badges (diff) | |
| download | serenity-93b990d8d1bc9df69b8e27a3db61da570822aad6.tar.xz serenity-93b990d8d1bc9df69b8e27a3db61da570822aad6.zip | |
Clean up the codebase
Diffstat (limited to 'src/utils/mod.rs')
| -rw-r--r-- | src/utils/mod.rs | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 0c154dd..aa97f4a 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -21,60 +21,6 @@ use ::internal::prelude::*; pub use self::message_builder::MessageBuilder; -macro_rules! cdn_concat { - ($e:expr) => { - concat!("https://cdn.discordapp.com", $e) - } -} -macro_rules! api { - ($e:expr) => { - concat!("https://discordapp.com/api/v6", $e) - }; - ($e:expr, $($rest:tt)*) => { - format!(api!($e), $($rest)*) - }; -} - -macro_rules! api_concat { - ($e:expr) => { - concat!("https://discordapp.com/api/v6", $e) - } -} -macro_rules! status_concat { - ($e:expr) => { - concat!("https://status.discordapp.com/api/v2", $e) - } -} - -macro_rules! map_nums { - ($item:ident; $($entry:ident $value:expr,)*) => { - impl $item { - #[allow(dead_code)] - pub fn num(&self) -> u64 { - match *self { - $($item::$entry => $value,)* - } - } - - #[allow(dead_code)] - pub fn from_num(num: u64) -> Option<Self> { - match num { - $($value => Some($item::$entry),)* - _ => None, - } - } - - #[allow(dead_code)] - fn decode(value: Value) -> Result<Self> { - value.as_u64().and_then(Self::from_num).ok_or(Error::Decode( - concat!("Expected valid ", stringify!($item)), - value - )) - } - } - } -} - #[doc(hidden)] pub fn decode_array<T, F: Fn(Value) -> Result<T>>(value: Value, f: F) -> Result<Vec<T>> { into_array(value).and_then(|x| x.into_iter().map(f).collect()) |