diff options
| author | Eskil Queseth <eskilq@kth.se> | 2020-10-31 02:37:24 +0100 |
|---|---|---|
| committer | Eskil Queseth <eskilq@kth.se> | 2020-10-31 02:37:24 +0100 |
| commit | d72b0fe5862a99d9ce1a0ef37938f4517de36ed7 (patch) | |
| tree | 00bae1b69ee302bb52bfb24d3fb22a34bccb3792 /mumlib | |
| parent | 11c823701b12f10933b40044a12cc4048ccf8bd2 (diff) | |
| download | mum-d72b0fe5862a99d9ce1a0ef37938f4517de36ed7.tar.gz | |
cargo fmt
Diffstat (limited to 'mumlib')
| -rw-r--r-- | mumlib/src/command.rs | 12 | ||||
| -rw-r--r-- | mumlib/src/config.rs | 9 |
2 files changed, 15 insertions, 6 deletions
diff --git a/mumlib/src/command.rs b/mumlib/src/command.rs index 26071ac..9b0c9ed 100644 --- a/mumlib/src/command.rs +++ b/mumlib/src/command.rs @@ -26,9 +26,15 @@ pub enum Command { #[derive(Debug, Deserialize, Serialize)] pub enum CommandResponse { - ChannelList { channels: Channel }, - ServerConnect { welcome_message: Option<String> }, - Status { server_state: Server }, + ChannelList { + channels: Channel, + }, + ServerConnect { + welcome_message: Option<String>, + }, + Status { + server_state: Server, + }, ServerStatus { version: u32, users: u32, diff --git a/mumlib/src/config.rs b/mumlib/src/config.rs index e7d107a..ae569aa 100644 --- a/mumlib/src/config.rs +++ b/mumlib/src/config.rs @@ -1,11 +1,11 @@ +use crate::DEFAULT_PORT; use serde::{Deserialize, Serialize}; use std::convert::TryFrom; use std::fs; +use std::net::{SocketAddr, ToSocketAddrs}; use std::path::Path; use toml::value::Array; use toml::Value; -use std::net::{SocketAddr, ToSocketAddrs}; -use crate::DEFAULT_PORT; #[derive(Debug, Deserialize, Serialize)] struct TOMLConfig { @@ -62,7 +62,10 @@ pub struct ServerConfig { impl ServerConfig { pub fn to_socket_addr(&self) -> Option<SocketAddr> { - match (self.host.as_str(), self.port.unwrap_or(DEFAULT_PORT)).to_socket_addrs().map(|mut e| e.next()) { + match (self.host.as_str(), self.port.unwrap_or(DEFAULT_PORT)) + .to_socket_addrs() + .map(|mut e| e.next()) + { Ok(Some(addr)) => Some(addr), _ => None, } |
