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 — fluent builder
11//! let mut server = Server::default();
12//! server.mechanism(ServerMechanism::get("/health").onconnect(|| async { reply!() }));
13//!
14//! // Server types — attribute macro shorthand
15//! #[mechanism(server, GET, "/hello")]
16//! async fn hello() { reply!() }
17//!
18//! // Client types
19//! let client = Client::new(Target::Localhost(8080));
20//! ```
21//!
22//! Re-exports are gated by feature flags:
23//! - `socket-server` / `socket`: [`Server`], [`ServerMechanism`], [`Status`], [`mechanism`]
24//! - `socket-client` / `socket`: [`Client`], [`ClientError`], [`Target`], [`request`]
25//! - always available: [`SerializationKey`]
26
27pub use crate::socket::SerializationKey;
28
29#[cfg(any(feature = "socket", feature = "socket-server"))]
30pub use crate::socket::server::{Server, ServerMechanism, Status, mechanism};
31
32#[cfg(any(feature = "socket", feature = "socket-client"))]
33pub use crate::socket::client::{Client, ClientError, Target, request};