xrpc/
lib.rs

1//! xrpc-rs: High-performance local IPC library for Rust.
2
3pub mod channel;
4pub mod client;
5pub mod codec;
6pub mod error;
7pub mod message;
8pub mod pool;
9pub mod server;
10pub mod streaming;
11pub mod transport;
12
13// Layer 1: FrameTransport
14pub use transport::arc::{ArcFrameTransport, ZeroCopyTransport};
15pub use transport::channel::{ChannelConfig, ChannelFrameTransport};
16pub use transport::shared_memory::{RetryPolicy, SharedMemoryConfig, SharedMemoryFrameTransport};
17pub use transport::tcp::{TcpConfig, TcpFrameTransport, TcpFrameTransportListener};
18pub use transport::{FrameTransport, TransportStats, spawn_weak_loop};
19
20#[cfg(unix)]
21pub use transport::unix::{UnixConfig, UnixFrameTransport, UnixFrameTransportListener};
22
23// Layer 2: Channel
24pub use channel::message::{MessageChannel, MessageChannelAdapter};
25pub use channel::serde::SerdeChannel;
26pub use channel::typed::TypedChannel;
27
28// Layer 3: RPC
29pub use client::{RpcClient, RpcClientHandle};
30pub use pool::{ConnectionPool, PoolConfig, PoolGuard};
31pub use server::{
32    FnHandler, FnStreamHandler, Handler, RpcServer, ServerHandle, ServerStreamSender,
33    StreamHandler, TypedHandler, TypedStreamHandler,
34};
35pub use streaming::{StreamId, StreamManager, StreamReceiver, StreamSender, next_stream_id};
36
37// Codec
38#[cfg(feature = "codec-cbor")]
39pub use codec::CborCodec;
40#[cfg(feature = "codec-messagepack")]
41pub use codec::MessagePackCodec;
42#[cfg(feature = "codec-postcard")]
43pub use codec::PostcardCodec;
44pub use codec::{BincodeCodec, Codec, JsonCodec};
45
46// Error types
47pub use error::{Result, RpcError, TransportError, TransportResult};
48
49// Message types
50pub use message::Message;
51pub use message::types::{MessageId, MessageType};
52
53// Deprecated aliases for backward compatibility
54#[deprecated(since = "0.2.0", note = "Use ArcFrameTransport instead")]
55pub type ArcTransport = ArcFrameTransport;
56
57#[deprecated(since = "0.2.0", note = "Use ChannelFrameTransport instead")]
58pub type ChannelTransport = ChannelFrameTransport;
59
60#[deprecated(since = "0.2.0", note = "Use SharedMemoryFrameTransport instead")]
61pub type SharedMemoryTransport = SharedMemoryFrameTransport;
62
63#[deprecated(since = "0.2.0", note = "Use TcpFrameTransport instead")]
64pub type TcpTransport = TcpFrameTransport;
65
66#[deprecated(since = "0.2.0", note = "Use TcpFrameTransportListener instead")]
67pub type TcpTransportListener = TcpFrameTransportListener;
68
69#[cfg(unix)]
70#[deprecated(since = "0.2.0", note = "Use UnixFrameTransport instead")]
71pub type UnixSocketTransport = UnixFrameTransport;
72
73#[cfg(unix)]
74#[deprecated(since = "0.2.0", note = "Use UnixFrameTransportListener instead")]
75pub type UnixSocketListener = UnixFrameTransportListener;
76
77#[deprecated(since = "0.2.0", note = "Use MessageChannelAdapter instead")]
78pub type MessageTransportAdapter<F, C = BincodeCodec> = MessageChannelAdapter<F, C>;
79
80#[deprecated(since = "0.2.0", note = "Use SerdeChannel instead")]
81pub type RawTransport<F> = SerdeChannel<F, BincodeCodec>;