fn create_event(evt: &str, params: &[JsonValue]) -> Result<Event, InvalidJsonError> {
        if evt == "COMMAND" {
            if params.len() >= 4 && params[3].is_string() {
                let cmd = params[3].as_str().unwrap().to_string();
                Ok(Event::new(
                    EventType::Command(cmd),
                    Event::param_strs(params),
                ))
            } else {
                Err(InvalidJsonError::new(""))
            }
        } else {
            match EventType::from_str(evt) {
                Ok(evt) => Ok(Event::new(evt, Event::param_strs(params))),
                Err(_) => Err(InvalidJsonError::new("")),
            }
        }
    }
/// Create a new event based on the properties extracted from the Json.
Create a new event based on the properties extracted from the Json.
Create a new event based on the properties extracted from the Json .
fn create_event(evt: &str, params: &[JsonValue]) -> Result<Event, InvalidJsonError> {
        if evt == "COMMAND" {
            if params.len() >= 4 && params[3].is_string() {
                let cmd = params[3].as_str().unwrap().to_string();
                Ok(Event::new(
                    EventType::Command(cmd),
                    Event::param_strs(params),
                ))
            } else {
                Err(InvalidJsonError::new(""))
            }
        } else {
            match EventType::from_str(evt) {
                Ok(evt) => Ok(Event::new(evt, Event::param_strs(params))),
                Err(_) => Err(InvalidJsonError::new("")),
            }
        }
    }
fn create_event ( evt : & str , params : & [ JsonValue ] ) -> Result < Event , InvalidJsonError > { if evt == " " { if params . len ( ) >= 4 && params [ 3 ] . is_string ( ) { let cmd = params [ 3 ] . as_str ( ) . unwrap ( ) . to_string ( ) ; Ok ( Event :: new ( EventType :: Command ( cmd ) , Event :: param_strs ( params ) , ) ) } else { Err ( InvalidJsonError :: new ( " " ) ) } } else { match EventType :: from_str ( evt ) { Ok ( evt ) => Ok ( Event :: new ( evt , Event :: param_strs ( params ) ) ) , Err ( _ ) => Err ( InvalidJsonError :: new ( " " ) ) , } } }
Create a new event based on the properties extracted from the Json.
Create a new event based on the properties extracted from the Json .
evt
&str
params
&[JsonValue]