Skip to main content

Module inproc

Module inproc 

Source
Expand description

In-process transport for zero-copy messaging within the same process.

The inproc transport provides high-performance communication between sockets in the same process using channels, without TCP/IP overhead.

§Features

  • Zero-copy: Messages are shared via Arc<Vec<Bytes>> between sockets
  • Thread-safe: Global registry protected by DashMap
  • Fast: No serialization, network, or syscall overhead
  • ZeroMQ compatible: Uses inproc:// URI scheme

§Usage

use monocoque_core::inproc::{bind_inproc, connect_inproc};
use bytes::Bytes;

// Bind to an inproc endpoint
let (sender, receiver) = bind_inproc("inproc://my-endpoint").unwrap();

// Connect from another task
let client = connect_inproc("inproc://my-endpoint").unwrap();

// Send messages
client.send(vec![Bytes::from("Hello")]).unwrap();

// Receive messages
if let Ok(msg) = receiver.recv() {
    println!("Received: {:?}", msg);
}

Functions§

bind_inproc
Bind to an inproc endpoint and return sender/receiver pair.
bind_inproc_bidi
Bind to an inproc endpoint for bidirectional communication.
connect_inproc
Connect to an inproc endpoint.
connect_inproc_bidi
Connect to an inproc endpoint for bidirectional communication.
list_inproc_endpoints
List all currently bound inproc endpoints.
unbind_inproc
Unbind an inproc endpoint, removing it from the global registry.

Type Aliases§

InprocMessage
Message type for inproc transport (multipart message)
InprocReceiver
Receiver half of an inproc connection
InprocSender
Sender half of an inproc connection