phantom_protocol/api/mod.rs
1//! Phantom Protocol Public API
2//!
3//! Transport session facade for the SDK.
4//! - [`session::PhantomSession`] — Client-first transport session (all targets)
5//! - [`stream::PhantomStream`] — Multiplexed reliable stream (all targets)
6//! - [`listener::PhantomListener`] — Server socket listener (native only)
7//! - [`tcp_transport::TcpSessionTransport`] — Length-prefixed framing over TCP (native only)
8//!
9//! On `wasm32-unknown-unknown` (browser) targets the TCP-based building
10//! blocks are absent; use `WebSocketLeg` as
11//! the `SessionTransport` implementation. On `wasm32-wasi*` targets
12//! with `--features wasi-leg`, use
13//! `WasiLeg` (paired with
14//! `WasiRuntime`) for a TCP-shaped
15//! transport over WASI Preview 2 sockets.
16
17pub mod session;
18pub mod stream;
19
20#[cfg(not(target_arch = "wasm32"))]
21pub mod listener;
22#[cfg(not(target_arch = "wasm32"))]
23pub mod tcp_transport;
24#[cfg(not(target_arch = "wasm32"))]
25pub mod udp_listener;
26#[cfg(not(target_arch = "wasm32"))]
27pub mod udp_transport;
28
29#[cfg(test)]
30mod loss_recovery_tests;
31
32// Cross-target re-exports
33pub use session::{ConnectionState, PhantomSession, SessionTransport};
34pub use stream::PhantomStream;
35
36// Native-only re-exports
37#[cfg(not(target_arch = "wasm32"))]
38pub use listener::PhantomListener;
39#[cfg(not(target_arch = "wasm32"))]
40pub use tcp_transport::TcpSessionTransport;
41#[cfg(not(target_arch = "wasm32"))]
42pub use udp_listener::PhantomUdpListener;
43#[cfg(not(target_arch = "wasm32"))]
44pub use udp_transport::UdpClientTransport;