This commit is contained in:
ntr 2018-09-08 00:32:30 +10:00
parent 10b7550284
commit a48d7bcc68

View File

@ -20,8 +20,10 @@ pub struct GenerateParams {
impl Rpc {
pub fn receive(&self, msg: Message) -> StdResult<Vec<u8>, RpcError> {
// specify rpc message as the resulting type
// consume the ws data into bytes
let data = msg.into_data();
// cast the msg to this type to receive method name
match from_slice::<RpcMessage>(&data) {
Ok(v) => {
@ -53,11 +55,6 @@ pub enum RpcError {
UnknownMethod,
}
#[derive(Debug,Clone,Serialize,Deserialize)]
enum RpcParam {
GenerateParams { level: u16 },
}
#[cfg(test)]
mod tests {
use super::*;