Skip to main content

tokio_websockets/
lib.rs

1#![deny(
2    clippy::pedantic,
3    clippy::missing_docs_in_private_items,
4    clippy::missing_errors_doc,
5    rustdoc::broken_intra_doc_links,
6    warnings
7)]
8#![cfg_attr(docsrs, feature(doc_cfg))]
9// Required for NEON on 32-bit ARM until stable
10#![cfg_attr(
11    all(feature = "nightly", target_arch = "arm"),
12    feature(
13        stdarch_arm_neon_intrinsics,
14        stdarch_arm_feature_detection,
15        arm_target_feature
16    )
17)]
18// Required for VSX until stable
19#![cfg_attr(
20    all(
21        feature = "nightly",
22        any(target_arch = "powerpc64", target_arch = "powerpc")
23    ),
24    feature(
25        stdarch_powerpc,
26        stdarch_powerpc_feature_detection,
27        powerpc_target_feature
28    )
29)]
30// Required for s390x vectors until stable
31#![cfg_attr(
32    all(feature = "nightly", target_arch = "s390x"),
33    feature(stdarch_s390x)
34)]
35// Required for LASX until stable
36#![cfg_attr(
37    all(feature = "nightly", target_arch = "loongarch64"),
38    feature(stdarch_loongarch)
39)]
40#![cfg_attr(
41    all(
42        feature = "nightly",
43        feature = "client",
44        not(feature = "fastrand"),
45        not(feature = "getrandom"),
46        not(feature = "rand"),
47    ),
48    feature(random)
49)]
50#![doc = include_str!("../README.md")]
51
52// If the client or server implementation is enabled, at least one SHA1 backend
53// is required.
54#[cfg(all(
55    any(feature = "client", feature = "server"),
56    not(any(
57        feature = "ring",
58        feature = "aws_lc_rs",
59        feature = "openssl",
60        feature = "sha1_smol"
61    ))
62))]
63compile_error!("client and server implementation require at least one SHA1 backend");
64
65#[cfg(feature = "client")]
66pub mod client;
67pub mod error;
68mod mask;
69pub mod proto;
70#[cfg(feature = "client")]
71mod rand;
72#[cfg(feature = "client")]
73pub mod resolver;
74#[cfg(feature = "server")]
75pub mod server;
76#[cfg(any(feature = "client", feature = "server"))]
77mod sha;
78pub mod tls;
79#[cfg(any(feature = "client", feature = "server"))]
80pub mod upgrade;
81mod utf8;
82
83#[cfg(feature = "client")]
84pub use client::Builder as ClientBuilder;
85pub use error::Error;
86pub use proto::{CloseCode, Config, Limits, Message, Payload, WebSocketStream};
87#[cfg(feature = "server")]
88pub use server::Builder as ServerBuilder;
89pub use tls::{Connector, MaybeTlsStream};