new-home-application 0.1.3

New Home iot application framework. Meant to build application for the New Home Core
Documentation
use serde::{Deserialize, Serialize};

/// Contains the information about the app author and the app itself
#[derive(Serialize, Deserialize, Clone)]
pub struct ApplicationInfo {
    /// Contains the name of the app
    pub name: String,

    /// Contains the description of the app and what it is meant to do
    pub description: String,

    /// A comma separated list of authors
    pub authors: String,

    /// A version string for the app
    /// Can be "testing" or "1.6.4-rc.X" for example
    /// Aims to follow the semver pattern in public releases
    pub version: String,
}

/// Contains configuration and information about the app
/// Contains the ip and port on which the method server should run
#[derive(Clone)]
pub struct ApplicationConfig {
    /// The `ApplicationInfo` struct which contains all kinds of useful information about the application
    pub app_info: ApplicationInfo,

    /// Contains the IP as a string on which the application should run
    pub ip: String,

    /// Contains the Port as an i16 on which the server should listen for new TCP connections
    pub port: i16,
}

impl ApplicationConfig {
    pub fn new(app_info: ApplicationInfo, ip: String, port: i16) -> Self {
        Self {
            app_info,
            ip,
            port,
        }
    }
}