Move result structures to a more appropriate location

This commit is contained in:
Pierre HUBERT 2022-10-17 08:24:40 +02:00
parent 9162c5eb24
commit 171c88f303
5 changed files with 13 additions and 13 deletions

View File

@ -6,7 +6,7 @@ use hyper_rustls::ConfigBuilderExt;
use sea_battle_backend::data::GameRules; use sea_battle_backend::data::GameRules;
use sea_battle_backend::human_player_ws::{ClientMessage, ServerMessage}; use sea_battle_backend::human_player_ws::{ClientMessage, ServerMessage};
use sea_battle_backend::server::{BotPlayQuery, PlayRandomQuery}; use sea_battle_backend::server::{BotPlayQuery, PlayRandomQuery};
use sea_battle_backend::utils::{boxed_error, Res}; use sea_battle_backend::utils::res_utils::{boxed_error, Res};
use std::fmt::Display; use std::fmt::Display;
use std::sync::mpsc::TryRecvError; use std::sync::mpsc::TryRecvError;
use std::sync::{mpsc, Arc}; use std::sync::{mpsc, Arc};

View File

@ -23,7 +23,7 @@ use cli_player::ui_screens::select_play_mode_screen::{SelectPlayModeResult, Sele
use cli_player::ui_screens::*; use cli_player::ui_screens::*;
use sea_battle_backend::consts::{MAX_PLAYER_NAME_LENGTH, MIN_PLAYER_NAME_LENGTH}; use sea_battle_backend::consts::{MAX_PLAYER_NAME_LENGTH, MIN_PLAYER_NAME_LENGTH};
use sea_battle_backend::data::GameRules; use sea_battle_backend::data::GameRules;
use sea_battle_backend::utils::Res; use sea_battle_backend::utils::res_utils::Res;
/// Test code screens /// Test code screens
async fn run_dev<B: Backend>( async fn run_dev<B: Backend>(

View File

@ -12,8 +12,8 @@ use tui::{Frame, Terminal};
use sea_battle_backend::data::{Coordinates, CurrentGameMapStatus, CurrentGameStatus}; use sea_battle_backend::data::{Coordinates, CurrentGameMapStatus, CurrentGameStatus};
use sea_battle_backend::human_player_ws::{ClientMessage, ServerMessage}; use sea_battle_backend::human_player_ws::{ClientMessage, ServerMessage};
use sea_battle_backend::utils::res_utils::Res;
use sea_battle_backend::utils::time_utils::time; use sea_battle_backend::utils::time_utils::time;
use sea_battle_backend::utils::Res;
use crate::client::Client; use crate::client::Client;
use crate::constants::*; use crate::constants::*;

View File

@ -1,13 +1,4 @@
use std::error::Error;
use std::fmt::Display;
use std::io::ErrorKind;
pub mod network_utils; pub mod network_utils;
pub mod res_utils;
pub mod string_utils; pub mod string_utils;
pub mod time_utils; pub mod time_utils;
pub type Res<E = ()> = Result<E, Box<dyn Error>>;
pub fn boxed_error<D: Display>(msg: D) -> Box<dyn Error> {
Box::new(std::io::Error::new(ErrorKind::Other, msg.to_string()))
}

View File

@ -0,0 +1,9 @@
use std::error::Error;
use std::fmt::Display;
use std::io::ErrorKind;
pub type Res<E = ()> = Result<E, Box<dyn Error>>;
pub fn boxed_error<D: Display>(msg: D) -> Box<dyn Error> {
Box::new(std::io::Error::new(ErrorKind::Other, msg.to_string()))
}