add wisp lib

This commit is contained in:
Toshit Chawda 2024-01-22 08:59:53 -08:00
parent 48e9836515
commit ad7a34e86d
No known key found for this signature in database
GPG key ID: 91480ED99E2B3D9D
10 changed files with 857 additions and 255 deletions

25
wisp/src/lib.rs Normal file
View file

@ -0,0 +1,25 @@
mod packet;
mod ws;
pub use crate::packet::*;
#[derive(Debug, PartialEq)]
pub enum Role {
Client,
Server,
}
pub enum WispError {
PacketTooSmall,
InvalidPacketType,
WsFrameInvalidType,
WsFrameNotFinished,
WsImplError(Box<dyn std::error::Error>),
Utf8Error(std::str::Utf8Error),
}
impl From<std::str::Utf8Error> for WispError {
fn from(err: std::str::Utf8Error) -> WispError {
WispError::Utf8Error(err)
}
}