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: view.rs
    path of file: ./repos/mCaptcha/src/pages/panel/sitekey
    
    the code of the file until where you have to start completion: // Copyright (C) 2022  Aravinth Manivannan <realaravinth@batsense.net>
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
//
// SPDX-License-Identifier: AGPL-3.0-or-later

use actix_identity::Identity;
use actix_web::{web, HttpResponse, Responder};
use sailfish::TemplateOnce;

use db_core::Captcha;
use libmcaptcha::defense::Level;

use crate::errors::*;
use crate::stats::CaptchaStats;
use crate::AppData;

const PAGE: &str = "SiteKeys";

#[derive(TemplateOnce, Clone)]
#[template(path = "panel/sitekey/view/index.html")]
struct IndexPage {
    duration: u32,
    name: String,
    key: String,
    levels: Vec<Level>,
    stats: CaptchaStats,
    publish_benchmarks: bool,
}

impl IndexPage {
    fn new(
        stats: CaptchaStats,
        config: Captcha,
        levels: Vec<Level>,
        key: String,
        publish_benchmarks: bool,
    ) -> Self {
        IndexPage {
            duration: config.duration as u32,
            name: config.description,
            levels,
            key,
            stats,
            publish_benchmarks,
        }
    
    
    async fn view_sitekey_work(data: ArcData) {
        const NAME: &str = "viewsitekeyuser";
        const PASSWORD: &str = "longpassworddomain";
        const EMAIL: &str = "viewsitekeyuser@a.com";

        let data = &data;
        delete_user(data, NAME).await;

        register_and_signin(data, NAME, EMAIL, PASSWORD).await;
        let (_, signin_resp, key) = add_levels_util(data, NAME, PASSWORD).await;
        let cookies = get_cookie!(signin_resp);

        let app = get_app!(data).await;

        let url = format!("/sitekey/{}/", &key.key);

        let list_sitekey_resp = test::call_service(
            &app,
            test::TestRequest::get()
                .uri(&url)
                .cookie(cookies.clone())
                .to_request(),
        )
        .await;

        assert_eq!(list_sitekey_resp.status(), StatusCode::OK);

        let body: Bytes = test::read_body(list_sitekey_resp).await;
        let body = String::from_utf8(body.to_vec()).unwrap();

        assert!(body.contains(&key.name));

        assert!(body.contains(&L1.visitor_threshold.to_string()));
        assert!(body.contains(&L1.difficulty_factor.to_string()));
        assert!(body.contains(&L2.difficulty_factor.to_string()));
        assert!(body.contains(&L2.visitor_threshold.to_string()));
    }