robotech 0.13.0

Backend service implementation for the RoboTech platform, providing RESTful APIs and business logic for web applications.
Documentation
use serde::{Deserialize, Serialize};
use wheel_rs::serde::vec_option_serde;

#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "kebab-case")]
pub struct WebServerSettings {
    /// 绑定的IP地址
    #[serde(with = "vec_option_serde", default = "bind_default")]
    pub bind: Option<Vec<String>>,
    /// Web服务器的端口号
    #[serde(default = "port_default")]
    pub port: Option<u16>,

    /// 监听地址(ip+':'+port,例如127.0.0.1:80或\[::\]:80)
    #[serde(with = "vec_option_serde", default = "listen_default")]
    pub listen: Option<Vec<String>>,
}

impl Default for WebServerSettings {
    fn default() -> Self {
        WebServerSettings {
            bind: bind_default(),
            port: port_default(),
            listen: listen_default(),
        }
    }
}

fn bind_default() -> Option<Vec<String>> {
    None
}
fn port_default() -> Option<u16> {
    Some(0)
}

fn listen_default() -> Option<Vec<String>> {
    None
}