toolkit_zero/socket/prelude.rs
1
2//! Convenience re-exports for the `socket` module.
3//!
4//! Importing this prelude brings the most commonly used server and client
5//! types into scope through a single `use` path:
6//!
7//! ```rust,no_run
8//! use toolkit_zero::socket::prelude::*;
9//!
10//! // Server types
11//! let mut server = Server::default();
12//! server.mechanism(ServerMechanism::get("/health").onconnect(|| async { reply!() }));
13//!
14//! // Client types
15//! let client = Client::new(Target::Localhost(8080));
16//! ```
17//!
18//! Re-exports are gated by feature flags: [`Server`], [`ServerMechanism`], and
19//! [`Status`] are available under `socket-server`; [`Client`] and [`Target`]
20//! are available under `socket-client`. Enabling `socket` provides both.
21
22pub use crate::socket::SerializationKey;
23
24#[cfg(any(feature = "socket", feature = "socket-server"))]
25pub use crate::socket::server::{Server, ServerMechanism, Status};
26
27#[cfg(any(feature = "socket", feature = "socket-client"))]
28pub use crate::socket::client::{Client, ClientError, Target};