fetchlet 0.1.1

Rust-hosted JavaScript functions and Fetch handlers with explicit host services
Documentation
use serde_json::Value;
use tokio::sync::oneshot;

use crate::{Call, CallOutput, Request, Response, Result};

/// Work sent from an [`AppHandle`](super::AppHandle) to its worker thread.
#[cfg_attr(
    not(any(feature = "boa", feature = "quickjs", feature = "v8")),
    expect(
        dead_code,
        reason = "only an engine runs the worker that reads commands"
    )
)]
pub(super) enum Command {
    Call {
        call: Call,
        reply: oneshot::Sender<Result<CallOutput>>,
    },
    Fetch {
        request: Box<Request>,
        context: Option<Value>,
        reply: oneshot::Sender<Result<Response>>,
    },
}