pub fn from_json(data: &JsonValue) -> Result<Event, InvalidJsonError> {
        if data.is_object() {
            let obj = data.as_object().unwrap();
            if obj.contains_key("event") && obj.contains_key("params") {
                let evt = obj.get("event").unwrap();
                let params = obj.get("params").unwrap();
                if evt.is_string() && params.is_array() {
                    Event::create_event(evt.as_str().unwrap(), &params.as_array().unwrap())
                } else {
                    Err(InvalidJsonError::new(""))
                }
            } else {
                Err(InvalidJsonError::new(""))
            }
        } else {
            Err(InvalidJsonError::new(""))
        }
    }
/// Create a new event based on a Json data object.
///
/// Typically this method will be called by the bindings itself to create an event instance
/// from some received json blob from the core.
Create a new event based on a Json data object.
Typically this method will be called by the bindings itself to create an event instance
from some received json blob from the core.
Create a new event based on a Json data object . Typically this method will be called by the bindings itself to create an event instance from some received json blob from the core .
pub fn from_json(data: &JsonValue) -> Result<Event, InvalidJsonError> {
        if data.is_object() {
            let obj = data.as_object().unwrap();
            if obj.contains_key("event") && obj.contains_key("params") {
                let evt = obj.get("event").unwrap();
                let params = obj.get("params").unwrap();
                if evt.is_string() && params.is_array() {
                    Event::create_event(evt.as_str().unwrap(), &params.as_array().unwrap())
                } else {
                    Err(InvalidJsonError::new(""))
                }
            } else {
                Err(InvalidJsonError::new(""))
            }
        } else {
            Err(InvalidJsonError::new(""))
        }
    }
pub fn from_json ( data : & JsonValue ) -> Result < Event , InvalidJsonError > { if data . is_object ( ) { let obj = data . as_object ( ) . unwrap ( ) ; if obj . contains_key ( " " ) && obj . contains_key ( " " ) { let evt = obj . get ( " " ) . unwrap ( ) ; let params = obj . get ( " " ) . unwrap ( ) ; if evt . is_string ( ) && params . is_array ( ) { Event :: create_event ( evt . as_str ( ) . unwrap ( ) , & params . as_array ( ) . unwrap ( ) ) } else { Err ( InvalidJsonError :: new ( " " ) ) } } else { Err ( InvalidJsonError :: new ( " " ) ) } } else { Err ( InvalidJsonError :: new ( " " ) ) } }
Create a new event based on a Json data object.
Create a new event based on a Json data object .
data
&JsonValue