Refactored types

This commit is contained in:
2026-02-19 00:23:47 +01:00
parent c5dd9f019d
commit 8d67252800
6 changed files with 76 additions and 59 deletions
+24
View File
@@ -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)
}
}