comments
This commit is contained in:
parent
10b7550284
commit
a48d7bcc68
@ -20,8 +20,10 @@ pub struct GenerateParams {
|
|||||||
|
|
||||||
impl Rpc {
|
impl Rpc {
|
||||||
pub fn receive(&self, msg: Message) -> StdResult<Vec<u8>, RpcError> {
|
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();
|
let data = msg.into_data();
|
||||||
|
|
||||||
|
// cast the msg to this type to receive method name
|
||||||
match from_slice::<RpcMessage>(&data) {
|
match from_slice::<RpcMessage>(&data) {
|
||||||
Ok(v) => {
|
Ok(v) => {
|
||||||
|
|
||||||
@ -53,11 +55,6 @@ pub enum RpcError {
|
|||||||
UnknownMethod,
|
UnknownMethod,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug,Clone,Serialize,Deserialize)]
|
|
||||||
enum RpcParam {
|
|
||||||
GenerateParams { level: u16 },
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user