Move result structures to a more appropriate location
This commit is contained in:
parent
9162c5eb24
commit
171c88f303
@ -6,7 +6,7 @@ use hyper_rustls::ConfigBuilderExt;
|
||||
use sea_battle_backend::data::GameRules;
|
||||
use sea_battle_backend::human_player_ws::{ClientMessage, ServerMessage};
|
||||
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::sync::mpsc::TryRecvError;
|
||||
use std::sync::{mpsc, Arc};
|
||||
|
@ -23,7 +23,7 @@ use cli_player::ui_screens::select_play_mode_screen::{SelectPlayModeResult, Sele
|
||||
use cli_player::ui_screens::*;
|
||||
use sea_battle_backend::consts::{MAX_PLAYER_NAME_LENGTH, MIN_PLAYER_NAME_LENGTH};
|
||||
use sea_battle_backend::data::GameRules;
|
||||
use sea_battle_backend::utils::Res;
|
||||
use sea_battle_backend::utils::res_utils::Res;
|
||||
|
||||
/// Test code screens
|
||||
async fn run_dev<B: Backend>(
|
||||
|
@ -12,8 +12,8 @@ use tui::{Frame, Terminal};
|
||||
|
||||
use sea_battle_backend::data::{Coordinates, CurrentGameMapStatus, CurrentGameStatus};
|
||||
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::Res;
|
||||
|
||||
use crate::client::Client;
|
||||
use crate::constants::*;
|
||||
|
@ -1,13 +1,4 @@
|
||||
use std::error::Error;
|
||||
use std::fmt::Display;
|
||||
use std::io::ErrorKind;
|
||||
|
||||
pub mod network_utils;
|
||||
pub mod res_utils;
|
||||
pub mod string_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()))
|
||||
}
|
||||
|
9
rust/sea_battle_backend/src/utils/res_utils.rs
Normal file
9
rust/sea_battle_backend/src/utils/res_utils.rs
Normal 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()))
|
||||
}
|
Loading…
Reference in New Issue
Block a user