Browse Source

PSOPacketData::from_bytes needs + Seek

pull/3/head
jake 5 years ago
parent
commit
81d3397c90
  1. 2
      psopacket/src/lib.rs
  2. 4
      src/lib.rs

2
psopacket/src/lib.rs

@ -529,7 +529,7 @@ pub fn pso_packet_data(input: TokenStream) -> TokenStream {
let impl_pso_data_packet = quote! {
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 {
#(#from_bytes)*
})

4
src/lib.rs

@ -7,7 +7,7 @@ pub mod packet;
pub mod character;
pub mod util;
use std::io::Read;
use std::io::{Read, Seek};
#[derive(Debug, PartialEq)]
pub enum PacketParseError {
NotEnoughBytes,
@ -21,7 +21,7 @@ pub enum PacketParseError {
trait PSOPacketData {
//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>;
}

Loading…
Cancel
Save