/// Parse the json input service data into a list of ServiceData
///
/// # Arguments
/// * `json_service_data`: The JSON representation of ServiceData to parse.
Parse the json input service data into a list of ServiceData
Parse the json input service data into a list of ServiceData
fn parse_service_data(json_service_data: &Vec<Value>) -> Result<Vec<ServiceData>, Error> {
            let mut manufacturer_data_list = Vec::new();
            for raw_service_data in json_service_data {
                let uuid = match raw_service_data.get("uuid") {
                    Some(v) => parse_uuid(v)?,
                    None => bail!("Missing Service data info 'uuid'."),
                };
                let data = match raw_service_data.get("data") {
                    Some(d) => d.to_string().into_bytes(),
                    None => bail!("Missing Service data info 'data'."),
                };
                manufacturer_data_list.push(ServiceData { uuid, data });
            }
            Ok(manufacturer_data_list)
        }
fn parse_service_data ( json_service_data : & Vec < Value > ) -> Result < Vec < ServiceData > , Error > { let mut manufacturer_data_list = Vec :: new ( ) ; for raw_service_data in json_service_data { let uuid = match raw_service_data . get ( " " ) { Some ( v ) => parse_uuid ( v ) ? , None => bail ! ( " " ) , } ; let data = match raw_service_data . get ( " " ) { Some ( d ) => d . to_string ( ) . into_bytes ( ) , None => bail ! ( " " ) , } ; manufacturer_data_list . push ( ServiceData { uuid , data } ) ; } Ok ( manufacturer_data_list ) }
Parse the json input service data into a list of ServiceData
Parse the json input service data into a list of ServiceData
json_service_data
&Vec<Value>