1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//! Transport abstraction layer.
//!
//! This module defines the trait hierarchy that decouples the Rift protocol
//! implementation from any particular network transport. The server works
//! exclusively with these traits, while framework-specific adapters (axum,
//! actix-web, warp, ntex) provide concrete implementations.
//!
//! # Trait hierarchy
//!
//! - [`Transport`] — a transport binding that can listen on a socket address.
//! - [`TransportListener`] — a bound listener that accepts incoming connections.
//! - [`TransportConnection`] — a single bidirectional connection that can read
//! and write [`Frame`](crate::frame::Frame)s.
//!
//! # Built-in adapters
//!
//! | Feature flag | Module | Description |
//! |---------------|-------------|--------------------------------------|
//! | `websocket` | [`websocket`] | Standalone WebSocket via tungstenite |
//! | `axum` | [`axum`] | Axum WebSocket adapter |
//! | `actix-web` | [`actix`] | Actix-web WebSocket adapter |
//! | `warp` | [`warp`] | Warp WebSocket adapter |
//! | `ntex` | [`ntex`] | Ntex WebSocket adapter |
//!
//! The [`bridge`] module (used by actix-web and ntex) provides a channel-based
//! bridge for frameworks whose WebSocket types are `!Send`.
// Channel bridge for non-Send WS types (actix-web, ntex).
use async_trait;
use SocketAddr;
use crateResult;
use crateFrame;
use crateCloseCode;
/// A transport binding — the entry point for listening on a network address.
///
/// Implementations are lightweight and cloneable. The server holds one
/// `Transport` and calls [`bind`](Transport::bind) to create a
/// [`TransportListener`] when it starts accepting connections.
///
/// Built-in implementations: [`WebSocketTransport`](websocket::WebSocketTransport).
/// Additional implementations can be added for WebTransport, TCP, Unix
/// sockets, or any other bidirectional byte-stream transport.
/// A bound transport listener that accepts incoming connections.
///
/// Created by [`Transport::bind`]. Each call to [`accept`](TransportListener::accept)
/// yields the next incoming [`TransportConnection`], or an error if the
/// listener has failed.
/// A single bidirectional transport connection.
///
/// Implementations read and write [`Frame`](crate::frame::Frame)s using
/// the binary or text wire format defined in
/// [`frame_codec`](crate::transport::frame_codec). The connection is
/// consumed by [`Connection::run`](crate::connection::Connection::run).