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: engine.rs
    path of file: ./repos/lnx/lnx-server/src/routes
    
    the code of the file until where you have to start completion: use engine::structures::IndexDeclaration;
use routerify::ext::RequestExt;
use serde::Deserialize;

use crate::helpers::{atomic_store, LnxRequest, LnxResponse};
use crate::responders::json_response;
use crate::state::State;
use cra
    
pub async fn delete_index(req: LnxRequest) -> LnxResponse {
    let state = req.data::<State>().expect("get state");
    let index = get_or_400!(req.param("index"));

    let indexes: Vec<IndexDeclaration> = state
        .engine
        .get_all_indexes()
        .into_iter()
        .filter(|v| v.name() != index)
        .collect();

    let storage = state.storage.clone();

    // This kinda sucks that we have to do this due to Bincode not enjoying
    // the IndexDeclaration struct.
    let buffer = serde_json::to_vec(&indexes)?;
    atomic_store(storage, INDEX_KEYSPACE, buffer).await?;

    state.engine.remove_index(index).await?;

    json_response(200, "index deleted")
}