You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: response.rs
    path of file: ./repos/habitat/components/builder-api-client/src
    
    the code of the file until where you have to start completion: use crate::error::{Error,
                   Result};
use log::debug;
use reqwest::{header::AsHeaderName,
              Response,
              StatusCode};
use serde::Deserialize;
use std::fmt;

#[derive(Clone, Deserialize)]
#[serde(rename = "error")]
pub struct NetError {
    pub code: i32,
    pub msg:  String,
}

impl fmt::Display for NetError {
    fn fmt(&self, f: &mut
    
pub async fn err_from_response(response: Response) -> Error {
    let status = response.status();
    if status == StatusCode::UNAUTHORIZED {
        return Error::APIError(status,
                               "Please check that you have specified a valid Personal Access \
                                Token."
                                       .to_string());
    }

    match response.text().await {
        Ok(buff) => {
            match serde_json::from_str::<NetError>(&buff) {
                Ok(err) => Error::APIError(status, err.to_string()),
                Err(_) => Error::APIError(status, buff),
            }
        }
        Err(_) => Error::APIError(status, String::new()),
    }
}