Refactored types
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
use std::string::FromUtf8Error;
|
||||
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
Io(std::io::Error),
|
||||
InvalidFrame(String),
|
||||
HandshakeFailed(String),
|
||||
Utf8(FromUtf8Error),
|
||||
ConnectionClosed,
|
||||
}
|
||||
|
||||
impl From<std::io::Error> for Error {
|
||||
fn from(value: std::io::Error) -> Self {
|
||||
Self::Io(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<FromUtf8Error> for Error {
|
||||
fn from(value: FromUtf8Error) -> Self {
|
||||
Self::Utf8(value)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user