SeaBattle/rust/sea_battle_backend/src/utils/res_utils.rs

10 lines
252 B
Rust

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()))
}