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: index.rs
    path of file: ./repos/magnesium-oxide/src/routes/views
    
    the code of the file until where you have to start completion: use actix_web::{Error, HttpRequest, HttpResponse, Result};
use futures_util::StreamExt;

use crate::{structs::files::File, AppState};
use tera::Context;

pub async fn index(request: HttpRequest) -> Result<HttpResponse, Error> {
    let state = request.app_data::<AppState>().unwrap();

    let mut total_size: i64 = 0;
    let mut total_files: i64 = 0;

    {
        let files = state.database.collection::<File>("files");
   
    
pub async fn index(request: HttpRequest) -> Result<HttpResponse, Error> {
    let state = request.app_data::<AppState>().unwrap();

    let mut total_size: i64 = 0;
    let mut total_files: i64 = 0;

    {
        let files = state.database.collection::<File>("files");
        let mut cursor = files.find(None, None).await.unwrap();

        while let Some(file) = cursor.next().await {
            let file = file.unwrap();

            total_size += file.size;
            total_files += 1;
        }
    }

    let mut context = Context::new();
    context.insert("total_size", &total_size);
    context.insert("total_files", &total_files);
    context.insert("version", env!("CARGO_PKG_VERSION"));

    let html = state.tera.render("index.html", &context).unwrap();

    Ok(HttpResponse::Ok().content_type("text/html").body(html))
}