libpso/src/lib.rs

21 lines
408 B
Rust
Raw Normal View History

2019-06-23 15:52:54 -07:00
pub mod crypto;
pub mod packet;
2019-06-06 16:46:23 -07:00
#[derive(Debug, PartialEq)]
pub enum PacketParseError {
NotEnoughBytes,
WrongPacketCommand,
2019-06-23 15:52:54 -07:00
WrongPacketForServerType,
WrongPacketSize(u16, usize),
DataStructNotLargeEnough(u64, usize),
2019-05-29 22:34:00 -07:00
}
2019-06-06 16:46:23 -07:00
2019-06-23 15:52:54 -07:00
pub trait PSOPacket: std::fmt::Debug {
2019-06-06 16:46:23 -07:00
fn from_bytes(data: &Vec<u8>) -> Result<Self, PacketParseError> where Self: Sized;
fn as_bytes(&self) -> Vec<u8>;
}