fn parse_manufacturer_data(
            json_manufacturer_data: &Vec<Value>,
        ) -> Result<Vec<ManufacturerData>, Error> {
            let mut manufacturer_data_list = Vec::new();

            for raw_manufacturer_data in json_manufacturer_data {
                let company_id = match raw_manufacturer_data.get("id") {
                    Some(v) => match v.as_u64() {
                        Some(c) => c as u16,
                        None => bail!("Company id not a valid value."),
                    },
                    None => bail!("Missing Manufacturer info 'id'."),
                };
                let data = match raw_manufacturer_data.get("data") {
                    Some(d) => d.to_string().into_bytes(),
                    None => bail!("Missing Manufacturer info 'data'."),
                };
                manufacturer_data_list.push(ManufacturerData { company_id, data });
            }
            Ok(manufacturer_data_list)
        }
/// Parse the json input manufacturer data into a list of ManufacturerData
///
/// # Arguments
/// * `json_manufacturer_data`: The JSON representation of ManufacturerData to parse.
Parse the json input manufacturer data into a list of ManufacturerData
Parse the json input manufacturer data into a list of ManufacturerData
fn parse_manufacturer_data(
            json_manufacturer_data: &Vec<Value>,
        ) -> Result<Vec<ManufacturerData>, Error> {
            let mut manufacturer_data_list = Vec::new();
            for raw_manufacturer_data in json_manufacturer_data {
                let company_id = match raw_manufacturer_data.get("id") {
                    Some(v) => match v.as_u64() {
                        Some(c) => c as u16,
                        None => bail!("Company id not a valid value."),
                    },
                    None => bail!("Missing Manufacturer info 'id'."),
                };
                let data = match raw_manufacturer_data.get("data") {
                    Some(d) => d.to_string().into_bytes(),
                    None => bail!("Missing Manufacturer info 'data'."),
                };
                manufacturer_data_list.push(ManufacturerData { company_id, data });
            }
            Ok(manufacturer_data_list)
        }
fn parse_manufacturer_data ( json_manufacturer_data : & Vec < Value > , ) -> Result < Vec < ManufacturerData > , Error > { let mut manufacturer_data_list = Vec :: new ( ) ; for raw_manufacturer_data in json_manufacturer_data { let company_id = match raw_manufacturer_data . get ( " " ) { Some ( v ) => match v . as_u64 ( ) { Some ( c ) => c as u16 , None => bail ! ( " " ) , } , None => bail ! ( " " ) , } ; let data = match raw_manufacturer_data . get ( " " ) { Some ( d ) => d . to_string ( ) . into_bytes ( ) , None => bail ! ( " " ) , } ; manufacturer_data_list . push ( ManufacturerData { company_id , data } ) ; } Ok ( manufacturer_data_list ) }
Parse the json input manufacturer data into a list of ManufacturerData
Parse the json input manufacturer data into a list of ManufacturerData
json_manufacturer_data
&Vec<Value>
json_manufacturer_data
&Vec<Value>