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
25// Cross-target re-exports
26pub use session::{ConnectionState, PhantomSession, SessionTransport};
27pub use stream::PhantomStream;
28
29// Native-only re-exports
30#[cfg(not(target_arch = "wasm32"))]
31pub use listener::PhantomListener;
32#[cfg(not(target_arch = "wasm32"))]
33pub use tcp_transport::TcpSessionTransport;