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: query.rs
    path of file: ./repos/mail-server/crates/smtp/src/scripts/plugins
    
    the code of the file until where you have to start completion: /*
 * Copyright (c) 2023 Stalwart Labs Ltd.
 *
 * This file is part of Stalw
    
pub fn exec(ctx: PluginContext<'_>) -> Variable {
    let span = ctx.span;

    // Obtain store name
    let store = match &ctx.arguments[0] {
        Variable::String(v) if !v.is_empty() => ctx.core.shared.lookup_stores.get(v.as_ref()),
        _ => Some(&ctx.core.shared.default_lookup_store),
    };

    let store = if let Some(store) = store {
        store
    } else {
        tracing::warn!(
            parent: span,
            context = "sieve:query",
            event = "failed",
            reason = "Unknown store",
            store = ctx.arguments[0].to_string().as_ref(),
        );
        return false.into();
    };

    // Obtain query string
    let query = ctx.arguments[1].to_string();
    if query.is_empty() {
        tracing::warn!(
            parent: span,
            context = "sieve:query",
            event = "invalid",
            reason = "Empty query string",
        );
        return false.into();
    }

    // Obtain arguments
    let arguments = match &ctx.arguments[2] {
        Variable::Array(l) => l.iter().map(to_store_value).collect(),
        v => vec![to_store_value(v)],
    };

    // Run query
    if query
        .as_bytes()
        .get(..6)
        .map_or(false, |q| q.eq_ignore_ascii_case(b"SELECT"))
    {
        if let Ok(mut rows) = ctx.handle.block_on(store.query::<Rows>(&query, arguments)) {
            match rows.rows.len().cmp(&1) {
                Ordering::Equal => {
                    let mut row = rows.rows.pop().unwrap().values;
                    match row.len().cmp(&1) {
                        Ordering::Equal if !matches!(row.first(), Some(Value::Null)) => {
                            row.pop().map(into_sieve_value).unwrap()
                        }
                        Ordering::Less => Variable::default(),
                        _ => Variable::Array(
                            row.into_iter()
                                .map(into_sieve_value)
                                .collect::<Vec<_>>()
                                .into(),
                        ),
                    }
                }
                Ordering::Less => Variable::default(),
                Ordering::Greater => rows
                    .rows
                    .into_iter()
                    .map(|r| {
                        Variable::Array(
                            r.values
                                .into_iter()
                                .map(into_sieve_value)
                                .collect::<Vec<_>>()
                                .into(),
                        )
                    })
                    .collect::<Vec<_>>()
                    .into(),
            }
        } else {
            false.into()
        }
    } else {
        ctx.handle
            .block_on(store.query::<usize>(&query, arguments))
            .is_ok()
            .into()
    }
}