aboutsummaryrefslogtreecommitdiffstats
path: root/mumlib/src
diff options
context:
space:
mode:
Diffstat (limited to 'mumlib/src')
-rw-r--r--mumlib/src/command.rs8
-rw-r--r--mumlib/src/error.rs10
-rw-r--r--mumlib/src/lib.rs2
-rw-r--r--mumlib/src/state.rs20
4 files changed, 23 insertions, 17 deletions
diff --git a/mumlib/src/command.rs b/mumlib/src/command.rs
index a216445..e8f4a4d 100644
--- a/mumlib/src/command.rs
+++ b/mumlib/src/command.rs
@@ -20,10 +20,6 @@ pub enum Command {
#[derive(Debug, Deserialize, Serialize)]
pub enum CommandResponse {
- ChannelList {
- channels: Channel,
- },
- Status {
- server_state: Server,
- },
+ ChannelList { channels: Channel },
+ Status { server_state: Server },
}
diff --git a/mumlib/src/error.rs b/mumlib/src/error.rs
index cb88aa7..9728f32 100644
--- a/mumlib/src/error.rs
+++ b/mumlib/src/error.rs
@@ -1,6 +1,6 @@
-use serde::{Serialize, Deserialize};
-use std::fmt::Display;
use serde::export::Formatter;
+use serde::{Deserialize, Serialize};
+use std::fmt::Display;
pub type Result<T> = std::result::Result<T, Error>;
@@ -18,7 +18,9 @@ impl Display for Error {
Error::DisconnectedError => write!(f, "Not connected to a server"),
Error::AlreadyConnectedError => write!(f, "Already connected to a server"),
Error::InvalidChannelIdError(id) => write!(f, "Invalid channel id: {}", id),
- Error::InvalidServerAddrError(addr, port) => write!(f, "Invalid server address: {}:{}", addr, port),
+ Error::InvalidServerAddrError(addr, port) => {
+ write!(f, "Invalid server address: {}:{}", addr, port)
+ }
}
}
-} \ No newline at end of file
+}
diff --git a/mumlib/src/lib.rs b/mumlib/src/lib.rs
index b77653c..d989a7e 100644
--- a/mumlib/src/lib.rs
+++ b/mumlib/src/lib.rs
@@ -1,6 +1,6 @@
pub mod command;
-pub mod state;
pub mod error;
+pub mod state;
use colored::*;
use log::*;
diff --git a/mumlib/src/state.rs b/mumlib/src/state.rs
index 96598de..b09726e 100644
--- a/mumlib/src/state.rs
+++ b/mumlib/src/state.rs
@@ -1,6 +1,6 @@
+use serde::export::Formatter;
use serde::{Deserialize, Serialize};
use std::fmt::Display;
-use serde::export::Formatter;
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Server {
@@ -24,17 +24,25 @@ impl Channel {
pub fn iter(&self) -> Iter<'_> {
Iter {
me: Some(&self),
- channel: if self.children.len() > 0 { Some(0) } else { None },
- channels: self.children.iter().map(|e| e.iter()).collect()
+ channel: if self.children.len() > 0 {
+ Some(0)
+ } else {
+ None
+ },
+ channels: self.children.iter().map(|e| e.iter()).collect(),
}
}
pub fn users_iter(&self) -> UsersIter<'_> {
UsersIter {
channels: self.children.iter().map(|e| e.users_iter()).collect(),
- channel: if self.children.len() > 0 { Some(0) } else { None },
+ channel: if self.children.len() > 0 {
+ Some(0)
+ } else {
+ None
+ },
user: if self.users.len() > 0 { Some(0) } else { None },
- users: &self.users
+ users: &self.users,
}
}
}
@@ -125,4 +133,4 @@ impl Display for User {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.name)
}
-} \ No newline at end of file
+}