naia_socket_shared/
lib.rs1#![deny(
5 trivial_casts,
6 trivial_numeric_casts,
7 unstable_features,
8 unused_import_braces,
9 unused_qualifications
10)]
11
12#[macro_use]
13extern crate cfg_if;
14
15pub mod link_condition_logic;
18
19mod backends;
20mod identity_token;
21mod link_conditioner_config;
22mod socket_config;
23mod time_queue;
24mod url_parse;
25
26pub use backends::{Instant, Random};
27pub use identity_token::*;
28pub use link_conditioner_config::LinkConditionerConfig;
29pub use socket_config::SocketConfig;
30pub use time_queue::TimeQueue;
31pub use url_parse::{parse_server_url, url_to_socket_addr};
32
33#[cfg(all(
34 feature = "test_time",
35 not(all(target_arch = "wasm32", any(feature = "wbindgen", feature = "mquad")))
36))]
37pub use backends::TestClock;
38
39#[derive(Debug, Eq, PartialEq)]
40pub struct ChannelClosedError<T>(pub T);
41
42impl<T: std::fmt::Debug> std::error::Error for ChannelClosedError<T> {}
43
44impl<T> std::fmt::Display for ChannelClosedError<T> {
45 fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
46 write!(fmt, "channel closed")
47 }
48}
49
50cfg_if! {
51 if #[cfg(all(target_arch = "wasm32", feature = "wbindgen", feature = "mquad"))]
52 {
53 compile_error!("wasm target for 'naia_socket_shared' crate requires either the 'wbindgen' OR 'mquad' feature to be enabled, you must pick one.");
55 }
56 else if #[cfg(all(target_arch = "wasm32", not(feature = "wbindgen"), not(feature = "mquad")))]
57 {
58 compile_error!("wasm target for 'naia_socket_shared' crate requires either the 'wbindgen' or 'mquad' feature to be enabled, you must pick one.");
60 }
61}