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: http_externals_plugin.rs
    path of file: ./repos/rspack/crates/rspack_plugin_externals/src
    
    the code of the file until where you have to start completion: use once_cell::sync::Lazy;
use regex::Regex;
use rspack_core::{
  BoxPlugin, ExternalItem, ExternalItemFnCtx, ExternalItemFnResult, ExternalItemValue, PluginExt,
};

use crate::ExternalsPlugin;

static EXTERNAL_HTTP_REQUEST: Lazy<Regex> =
  Lazy::new(|| Regex::new(r"^(//|https?://|#)").expect("Invalid regex"));
static EXTERNAL_HTTP_STD_REQUEST: Lazy<Regex> =
  Lazy::new(|| Regex::new(r"^(//|https?://|std:)").expect("Invalid regex"));
static EXTERNAL_CSS_REQUEST: Lazy<Regex> =
  Lazy::new(|| Regex::new(r"^\.css(\?|$)").expect("Invalid regex"));

pub fn http_externals_rspack_plugin(css: bool, web_async: bool) -> BoxPlugin {
  if web_async {
    ExternalsPlugin::new("import".to_owned(), vec![http_external_item_web_async(css)]).boxed()
  } else {
    ExternalsPlugin::new("module".to_owned(), vec![http_external_item_web(css)]).boxed()
  }
}

fn http_external_item_web(css: bool) -> ExternalItem {
  ExternalItem::Fn(Box::new(move |ctx: ExternalItemFnCtx| {
    Box::pin(async move {
      if ctx.dependency_type == "url" {
        if EXTERNAL_HTTP_REQUEST.is_match(&ctx.request) {
          return Ok(ExternalItemFnResult {
            external_type: Some("asset".to_owned()),
            result: Some(ExternalItemValue::String(ctx.request)),
 
    
fn http_external_item_web(css: bool) -> ExternalItem {
  ExternalItem::Fn(Box::new(move |ctx: ExternalItemFnCtx| {
    Box::pin(async move {
      if ctx.dependency_type == "url" {
        if EXTERNAL_HTTP_REQUEST.is_match(&ctx.request) {
          return Ok(ExternalItemFnResult {
            external_type: Some("asset".to_owned()),
            result: Some(ExternalItemValue::String(ctx.request)),
          });
        }
      } else if css && ctx.dependency_type == "css-import" {
        if EXTERNAL_HTTP_REQUEST.is_match(&ctx.request) {
          return Ok(ExternalItemFnResult {
            external_type: Some("css-import".to_owned()),
            result: Some(ExternalItemValue::String(ctx.request)),
          });
        }
      } else if EXTERNAL_HTTP_STD_REQUEST.is_match(&ctx.request) {
        if css && EXTERNAL_CSS_REQUEST.is_match(&ctx.request) {
          return Ok(ExternalItemFnResult {
            external_type: Some("css-import".to_owned()),
            result: Some(ExternalItemValue::String(ctx.request)),
          });
        } else {
          return Ok(ExternalItemFnResult {
            external_type: Some("module".to_owned()),
            result: Some(ExternalItemValue::String(ctx.request)),
          });
        }
      }
      Ok(ExternalItemFnResult {
        external_type: None,
        result: None,
      })
    })
  }))
}