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: handler.rs
    path of file: ./repos/rust-farm/handson/jwt-api/src/network
    
    the code of the file until where you have to start completion: use crate::data::db::{get_db_conn, ConnPool};
use crate::error::custom_error::CustomError;
use crate::error::handler::Result;
use crate::model::category::Category;
use crate::model::login_user::LoginUser;
use crate::model::registered_user::RegisteredUser;
use crate::model::user::User;
use crate::security::auditer::{create_hashed_pwd, create_jwt, verify_pwd};
use log::{error, info};
use warp::reply::html;
use warp::{
    http::{Response, StatusCode},
    reject, Reply,
};

/
    
pub async fn login(login_user: LoginUser, conn_pool: ConnPool) -> Result<impl Reply> {
    let db = get_db_conn(&conn_pool)
        .await
        .map_err(|_| reject::custom(CustomError::InternalError))?;

    let q = db
        .query_one(
            "SELECT id,username,password,role FROM users WHERE username = $1",
            &[&login_user.username],
        )
        .await
        .map_err(|_| reject::custom(CustomError::InvalidCredentials))?;

    let user = User {
        id: q.get::<&str, i32>("id"),
        username: q.get::<&str, String>("username"),
        password: q.get::<&str, String>("password"),
        role: q.get::<&str, String>("role"),
    };
    info!("Kullanıcı bulundu. Şifre kontrol ediliyor...");
    if !verify_pwd(&login_user.password, &user.password) {
        error!("{} için hatalı şifre", &login_user.username);
        return Ok(Response::builder()
            .status(StatusCode::BAD_REQUEST)
            .body("Login hatası".to_string()));
    }
    info!("Giriş başarılı");
    let token = create_jwt(&user);
    info!("Üretilen token {}", token);
    Ok(Response::builder().status(StatusCode::OK).body(token))
}