diff options
| author | Jokler <jokler.contact@gmail.com> | 2017-10-10 17:48:30 +0200 |
|---|---|---|
| committer | Jokler <jokler.contact@gmail.com> | 2017-10-11 15:41:32 +0200 |
| commit | 0195219d5c0b0ff1486b3e6bdcd62a807d3d2932 (patch) | |
| tree | 0e518f025de563a9df792ad8237275d3ad71af5d /src/plugins/currency.rs | |
| parent | ec33c870852f8a52f3cc0cf5a84b99c775dee1e3 (diff) | |
| download | frippy-0195219d5c0b0ff1486b3e6bdcd62a807d3d2932.tar.gz frippy-0195219d5c0b0ff1486b3e6bdcd62a807d3d2932.zip | |
Create plugin_derive to replace the register_plugin macro
Diffstat (limited to 'src/plugins/currency.rs')
| -rw-r--r-- | src/plugins/currency.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/plugins/currency.rs b/src/plugins/currency.rs index b2320ac..d29e560 100644 --- a/src/plugins/currency.rs +++ b/src/plugins/currency.rs @@ -6,14 +6,14 @@ extern crate regex; use std::io::Read; use irc::client::prelude::*; use irc::error::Error as IrcError; -use plugin::Plugin; use self::reqwest::Client; use self::reqwest::header::Connection; use self::serde_json::Value; -use PluginCommand; +use plugin::*; -register_plugin!(Currency); +#[derive(PluginName, Debug)] +pub struct Currency; struct ConvertionRequest<'a> { value: f64, @@ -62,6 +62,11 @@ impl<'a> ConvertionRequest<'a> { } impl Currency { + + pub fn new() -> Currency { + Currency {} + } + fn eval_command<'a>(&self, tokens: &'a [String]) -> Option<ConvertionRequest<'a>> { let parsed = match tokens[0].parse() { Ok(v) => v, @@ -144,5 +149,4 @@ impl Plugin for Currency { } #[cfg(test)] -mod tests { -} +mod tests {} |
