Skip to main content

tcplane/config/
struct.rs

1use crate::*;
2
3/// Represents the inner, mutable server configuration.
4///
5/// This structure holds all the settings for the TCP server,
6/// including network parameters and buffer sizes.
7#[derive(Clone)]
8pub(crate) struct ServerConfigData {
9    /// The host address the server will bind to.
10    pub(crate) host: String,
11    /// The port number the server will listen on.
12    pub(crate) port: u16,
13    /// The network buffer size for read operations.
14    pub(crate) buffer_size: usize,
15}
16
17/// Represents the thread-safe, shareable server configuration.
18///
19/// This structure wraps `ServerConfigData` in an `Arc<RwLock<ServerConfigData>>`
20/// to allow for safe concurrent access and modification of the server settings.
21#[derive(Clone)]
22pub struct ServerConfig(pub(super) ArcRwLock<ServerConfigData>);