Browse Source

Adopt Rust 2018 edition with idiomatic changes

master
Kevin Hoerr 11 months ago
parent
commit
909cf65c97
Signed by: kjhoerr GPG Key ID: 78E4BD33ACC22C86
9 changed files with 17 additions and 19 deletions
  1. +2
    -1
      Cargo.toml
  2. +3
    -9
      src/main.rs
  3. +2
    -1
      src/messages/callback.rs
  4. +1
    -0
      src/messages/mod.rs
  5. +2
    -1
      src/messages/not_understood.rs
  6. +2
    -2
      src/routes/callback.rs
  7. +2
    -2
      src/routes/format_msg.rs
  8. +1
    -1
      src/routes/mod.rs
  9. +2
    -2
      src/routes/not_understood.rs

+ 2
- 1
Cargo.toml View File

@ -1,6 +1,7 @@
[package]
edition = "2018"
name = "august-offensive"
version = "0.2.2"
version = "0.2.3"
authors = ["Kevin J Hoerr <kjhoerr@submelon.tech>"]
description = "Turn-based strategy game as a web service"
license = "ISC"

+ 3
- 9
src/main.rs View File

@ -1,20 +1,14 @@
extern crate actix_rt;
extern crate actix_web;
extern crate dotenv;
#[macro_use]
extern crate log;
extern crate env_logger;
#[macro_use]
extern crate diesel;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate log;
pub mod messages;
pub mod routes;
#[macro_use]
pub mod schema;
use actix_rt;
use actix_web::{middleware, App, HttpServer};
use diesel::pg::PgConnection;
use diesel::prelude::*;

+ 2
- 1
src/messages/callback.rs View File

@ -1,4 +1,5 @@
use messages::Message;
use crate::messages::Message;
use serde_derive::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Clone, Debug, Deserialize, Serialize)]

+ 1
- 0
src/messages/mod.rs View File

@ -5,6 +5,7 @@ pub mod not_understood;
pub use self::callback::Callback;
pub use self::not_understood::NotUnderstood;
use serde_derive::{Deserialize, Serialize};
#[derive(Deserialize, Serialize)]
pub struct OutgoingMsg<T: Message> {

+ 2
- 1
src/messages/not_understood.rs View File

@ -1,4 +1,5 @@
use messages::Message;
use crate::messages::Message;
use serde_derive::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct NotUnderstood {

+ 2
- 2
src/routes/callback.rs View File

@ -1,4 +1,4 @@
use routes::*;
use crate::routes::*;
// Sends Callback message with information from HttpRequest.
pub fn callback(req: HttpRequest, query: Query<HashMap<String, String>>) -> JsonMessage<Callback> {
@ -17,7 +17,7 @@ pub fn callback(req: HttpRequest, query: Query>) -> Json
#[cfg(test)]
mod tests {
use super::*;
use routes::tests::*;
use crate::routes::tests::*;
use actix_web::http::Method;
#[test]

+ 2
- 2
src/routes/format_msg.rs View File

@ -39,8 +39,8 @@ impl Responder for FormatMsg {
#[cfg(test)]
mod tests {
use super::*;
use routes::*;
use routes::tests::*;
use crate::routes::*;
use crate::routes::tests::*;
use serde::ser::{Error, Serializer};
#[test]

+ 1
- 1
src/routes/mod.rs View File

@ -1,6 +1,6 @@
use actix_web::{web::{route, scope, Query}, HttpRequest, Result, Scope};
use actix_web::http::StatusCode;
use messages::*;
use crate::messages::*;
use std::collections::HashMap;
pub mod format_msg;

+ 2
- 2
src/routes/not_understood.rs View File

@ -1,4 +1,4 @@
use routes::*;
use crate::routes::*;
// Sends a default response message when requested an undefined resource.
pub fn not_understood(req: HttpRequest) -> JsonMessage<NotUnderstood> {
@ -15,7 +15,7 @@ pub fn not_understood(req: HttpRequest) -> JsonMessage {
#[cfg(test)]
mod tests {
use super::*;
use routes::tests::*;
use crate::routes::tests::*;
#[test]
fn test_not_understood() {

Loading…
Cancel
Save