PSOPacketData::from_bytes needs + Seek
This commit is contained in:
parent
d2df4f6490
commit
81d3397c90
@ -529,7 +529,7 @@ pub fn pso_packet_data(input: TokenStream) -> TokenStream {
|
|||||||
|
|
||||||
let impl_pso_data_packet = quote! {
|
let impl_pso_data_packet = quote! {
|
||||||
impl PSOPacketData for #name {
|
impl PSOPacketData for #name {
|
||||||
fn from_bytes<R: std::io::Read>(mut cur: &mut R) -> Result<Self, PacketParseError> {
|
fn from_bytes<R: std::io::Read + std::io::Seek>(mut cur: &mut R) -> Result<Self, PacketParseError> {
|
||||||
Ok(#name {
|
Ok(#name {
|
||||||
#(#from_bytes)*
|
#(#from_bytes)*
|
||||||
})
|
})
|
||||||
|
@ -7,7 +7,7 @@ pub mod packet;
|
|||||||
pub mod character;
|
pub mod character;
|
||||||
pub mod util;
|
pub mod util;
|
||||||
|
|
||||||
use std::io::Read;
|
use std::io::{Read, Seek};
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub enum PacketParseError {
|
pub enum PacketParseError {
|
||||||
NotEnoughBytes,
|
NotEnoughBytes,
|
||||||
@ -21,7 +21,7 @@ pub enum PacketParseError {
|
|||||||
|
|
||||||
trait PSOPacketData {
|
trait PSOPacketData {
|
||||||
//fn size(&self) -> usize;
|
//fn size(&self) -> usize;
|
||||||
fn from_bytes<R: Read>(cursor: &mut R) -> Result<Self, PacketParseError> where Self: Sized;
|
fn from_bytes<R: Read + Seek>(cursor: &mut R) -> Result<Self, PacketParseError> where Self: Sized;
|
||||||
fn as_bytes(&self) -> Vec<u8>;
|
fn as_bytes(&self) -> Vec<u8>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user