-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from cwahbong/plugin-refactor2
Plugin refactor
- Loading branch information
Showing
13 changed files
with
106 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (c) The Swiboe development team. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See LICENSE.txt | ||
// in the project root for license information. | ||
use ::error::Result; | ||
use ::client; | ||
use std::collections::HashMap; | ||
|
||
pub type RpcMap = HashMap<String, Box<client::rpc::server::Rpc>>; | ||
|
||
macro_rules! rpc_map { | ||
($($s:expr => $rpc:expr),*) => {{ | ||
let mut map = $crate::plugin::RpcMap::new(); | ||
$(map.insert(String::from($s), Box::new($rpc));)* | ||
map | ||
}}; | ||
($($s:expr => $rpc:expr),*,) => { | ||
rpc_map!($($s => $rpc), *) | ||
}; | ||
} | ||
|
||
pub fn register_rpc(client: &mut client::Client, map: RpcMap) -> Result<()> { | ||
for (name, rpc) in map { | ||
try!(client.new_rpc(&name, rpc)); | ||
} | ||
Ok(()) | ||
} | ||
|
||
pub mod buffer; | ||
pub mod list_files; | ||
pub mod logger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.