pub fn parse_plain(string: &str) -> Option<RpcMessage> {
    let len = string.len();
    if len < 30 {
        // 30 is the smallest possible JSON-RPC message (notification, single-letter method)
        warn!("invalid plain message length ({}) received, ignoring", len);
        return None;
    }

    match serde_json::from_str::<RpcMessage>(string) {
        Err(err) => {
            warn!("invalid plain message: {}", err);
            None
        }
        Ok(rpc) => {
            trace!("valid plain message parsed: {:?}", rpc);
            Some(rpc)
        }
    }
}
/// Parses a regular string message as an RPC Message.
Parses a regular string message as an RPC Message.
Parses a regular string message as an RPC Message .
pub fn parse_plain(string: &str) -> Option<RpcMessage> {
    let len = string.len();
    if len < 30 {
        // 30 is the smallest possible JSON-RPC message (notification, single-letter method)
        warn!("invalid plain message length ({}) received, ignoring", len);
        return None;
    }
    match serde_json::from_str::<RpcMessage>(string) {
        Err(err) => {
            warn!("invalid plain message: {}", err);
            None
        }
        Ok(rpc) => {
            trace!("valid plain message parsed: {:?}", rpc);
            Some(rpc)
        }
    }
}
pub fn parse_plain ( string : & str ) -> Option < RpcMessage > { let len = string . len ( ) ; if len < 30 { // 30 is the smallest possible JSON-RPC message (notification, single-letter method) warn ! ( " " len ) ; return None ; } match serde_json :: from_str :: < RpcMessage > ( string ) { Err ( err ) => { warn ! ( " " err ) ; None } Ok ( rpc ) => { trace ! ( " " rpc ) ; Some ( rpc ) } } }
Parses a regular string message as an RPC Message.
Parses a regular string message as an RPC Message .
string
&str