fn fetch_n_parse() -> Result<LightClient, Error<T>> {
        let resp_bytes = Self::fetch_from_remote().map_err(|e| {
            debug::error!("fetch_from_remote error: {:?}", e);
            <Error<T>>::HttpFetchingError
        })?;

        let resp_str = str::from_utf8(&resp_bytes).map_err(|_| <Error<T>>::HttpFetchingError)?;
        // Print out our fetched JSON string
        debug::info!("{}", resp_str);

        // Deserializing JSON to struct, thanks to `serde` and `serde_derive`
        let data: LightClient =
            serde_json::from_str(&resp_str).map_err(|_| <Error<T>>::HttpNotParsedInStruct)?;
        Ok(data)
    }
/// Fetch from remote and deserialize the JSON to a struct
Fetch from remote and deserialize the JSON to a struct
Fetch from remote and deserialize the JSON to a struct
fn fetch_n_parse() -> Result<LightClient, Error<T>> {
        let resp_bytes = Self::fetch_from_remote().map_err(|e| {
            debug::error!("fetch_from_remote error: {:?}", e);
            <Error<T>>::HttpFetchingError
        })?;
        let resp_str = str::from_utf8(&resp_bytes).map_err(|_| <Error<T>>::HttpFetchingError)?;
        // Print out our fetched JSON string
        debug::info!("{}", resp_str);
        // Deserializing JSON to struct, thanks to `serde` and `serde_derive`
        let data: LightClient =
            serde_json::from_str(&resp_str).map_err(|_| <Error<T>>::HttpNotParsedInStruct)?;
        Ok(data)
    }
fn fetch_n_parse ( ) -> Result < LightClient , Error < T > > { let resp_bytes = Self :: fetch_from_remote ( ) . map_err ( | e | { debug :: error ! ( " " e ) ; < Error < T > > :: HttpFetchingError } ) ? ; let resp_str = str :: from_utf8 ( & resp_bytes ) . map_err ( | _ | < Error < T > > :: HttpFetchingError ) ? ; // Print out our fetched JSON string debug :: info ! ( " " resp_str ) ; // Deserializing JSON to struct, thanks to `serde` and `serde_derive` let data : LightClient = serde_json :: from_str ( & resp_str ) . map_err ( | _ | < Error < T > > :: HttpNotParsedInStruct ) ? ; Ok ( data ) }
Fetch from remote and deserialize the JSON to a struct
Fetch from remote and deserialize the JSON to a struct