Skip to content

Commit

Permalink
Implement Message (single-enum)
Browse files Browse the repository at this point in the history
Add relevant section of Protocol spec to message mod and variant docs

Depend on serde{,_json}. Dev-depend on rand

Credit Katt in Cargo.toml
  • Loading branch information
nabijaczleweli committed Mar 26, 2016
1 parent ec6f39a commit 63eabdd
Show file tree
Hide file tree
Showing 7 changed files with 1,925 additions and 1 deletion.
37 changes: 37 additions & 0 deletions server/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@ readme = "README.md"
keywords = ["game", "lounge", "server"]
license = "MIT"
version = "0.1.0"
authors = ["nabijaczleweli <[email protected]>"]
authors = ["nabijaczleweli <[email protected]>",
"Cat Plus Plus <[email protected]>"]

[dependencies]
serde = "0.7"
serde_json = "0.7"

[dev-dependencies]
rand = "0.3"
5 changes: 5 additions & 0 deletions server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
unused_results,
)]

extern crate serde_json;
extern crate serde;

pub mod message;

use std::env;
use std::vec::Vec;

Expand Down
15 changes: 15 additions & 0 deletions server/src/message/err.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use serde_json;

#[derive(Debug)]
pub enum MessageError {
JsonError(serde_json::Error),
PropertyMissing(String),
ExtraneousProperty(String),
BadType(String),
}

impl From<serde_json::Error> for MessageError {
fn from(sje: serde_json::Error) -> Self {
MessageError::JsonError(sje)
}
}
Loading

0 comments on commit 63eabdd

Please sign in to comment.