tungstenite/
lib.rs
1#![deny(
3 missing_docs,
4 missing_copy_implementations,
5 missing_debug_implementations,
6 trivial_casts,
7 trivial_numeric_casts,
8 unstable_features,
9 unused_must_use,
10 unused_mut,
11 unused_imports,
12 unused_import_braces
13)]
14#![allow(clippy::result_large_err)]
17
18#[cfg(feature = "handshake")]
19pub use http;
20
21pub mod buffer;
22#[cfg(feature = "handshake")]
23pub mod client;
24pub mod error;
25#[cfg(feature = "handshake")]
26pub mod handshake;
27pub mod protocol;
28#[cfg(feature = "handshake")]
29mod server;
30pub mod stream;
31#[cfg(all(any(feature = "native-tls", feature = "__rustls-tls"), feature = "handshake"))]
32mod tls;
33pub mod util;
34
35const READ_BUFFER_CHUNK_SIZE: usize = 4096;
36type ReadBuffer = buffer::ReadBuffer<READ_BUFFER_CHUNK_SIZE>;
37
38pub use crate::{
39 error::{Error, Result},
40 protocol::{frame::Utf8Bytes, Message, WebSocket},
41};
42pub use bytes::Bytes;
44
45#[cfg(feature = "handshake")]
46pub use crate::{
47 client::{client, connect, ClientRequestBuilder},
48 handshake::{client::ClientHandshake, server::ServerHandshake, HandshakeError},
49 server::{accept, accept_hdr, accept_hdr_with_config, accept_with_config},
50};
51
52#[cfg(all(any(feature = "native-tls", feature = "__rustls-tls"), feature = "handshake"))]
53pub use tls::{client_tls, client_tls_with_config, Connector};