Skip to main content

Module ipc

Module ipc 

Source
Expand description

Inter-Process Communication (IPC) for sandbox

This module provides type-safe IPC between sandboxed processes and the host. Communication happens over loopback TCP using MessagePack serialization.

§Example

use serde::{Serialize, Deserialize};
use heel::ipc::{IpcCommand, IpcRouter};

#[derive(Serialize, Deserialize, Default)]
struct WebSearch { query: String }

#[derive(Serialize, Deserialize)]
struct WebSearchResult { items: Vec<String> }

impl IpcCommand for WebSearch {
    type Response = WebSearchResult;

    fn name(&self) -> String { "web_search".to_string() }

    async fn handle(&mut self) -> WebSearchResult {
        WebSearchResult { items: do_search(&self.query).await }
    }
}

let router = IpcRouter::new()
    .register(WebSearch::default());

Structs§

CommandMeta
Metadata about a registered command
IpcRouter
Router that dispatches IPC requests to registered command handlers

Enums§

IpcError
Errors that can occur during IPC operations

Traits§

IpcCommand
A type-safe IPC command with its handler