From ba226cc28aae89c083c9ff3a8d5a0726ee866fd2 Mon Sep 17 00:00:00 2001 From: jake Date: Sun, 15 Sep 2019 15:06:15 -0700 Subject: [PATCH] remove pktvec --- src/common/mod.rs | 3 -- src/common/pktvec.rs | 90 ------------------------------------------ src/login/character.rs | 2 - src/login/login.rs | 3 +- 4 files changed, 1 insertion(+), 97 deletions(-) delete mode 100644 src/common/pktvec.rs diff --git a/src/common/mod.rs b/src/common/mod.rs index 32b021c..a52796e 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -1,6 +1,3 @@ -#[macro_use] -pub mod pktvec; - pub mod cipherkeys; pub mod network; pub mod serverstate; diff --git a/src/common/pktvec.rs b/src/common/pktvec.rs deleted file mode 100644 index bdb20fb..0000000 --- a/src/common/pktvec.rs +++ /dev/null @@ -1,90 +0,0 @@ -use std::collections::VecDeque; -use libpso::PSOPacket; - -pub struct PktVec { - pkts: VecDeque>, -} - -impl PktVec { - pub fn new() -> PktVec { - PktVec { - pkts: VecDeque::new(), - } - } - - pub fn push(&mut self, pkt: Box) { - self.pkts.push_back(pkt); - } - - pub fn append(&mut self, pkts: Vec>) { - self.pkts.append(&mut VecDeque::from(pkts)); - } - /*pub fn append(&mut self, pkts: &mut Vec>) { - self.pkts.append(&mut pkts.into()); - }*/ -} - - -impl Iterator for PktVec { - type Item = Box; - - fn next(&mut self) -> Option { - /*if self.index < self.pkts.len() { - let pkt = Some(self.pkts[self.index]); - self.index += 1; - pkt - } - else { - None - }*/ - self.pkts.pop_front() - } -} - -#[macro_export] -macro_rules! pktvec { - ( $( $pkt:expr ),* ) => { - { - let mut pkts = Box::new(PktVec::new()); - $( - pkts.push(Box::new($pkt)); - )* - pkts - } - }; -} - -/* -struct PktVecIter { - iter: Box>>, -} - -impl Iterator for PktVecIter { - type Item = Box; - - fn next(&mut self) -> Option { - self.iter.next() - } -} - - - - - -struct PktVec { - pkts: Vec> -} - -impl PktVec { - fn push(&mut self, pkt: impl PSOPacket) { - self.pkts.push(Box::new(pkt)) - } - - fn iter(&self) -> PktVecIter { - PktVecIter { - iter: self.pkts.iter() - } - } -} - -*/ diff --git a/src/login/character.rs b/src/login/character.rs index 44a4198..7120509 100644 --- a/src/login/character.rs +++ b/src/login/character.rs @@ -12,8 +12,6 @@ use libpso::{PacketParseError, PSOPacket}; use libpso::crypto::{CipherError, PSOCipher, NullCipher}; use libpso::crypto::bb::PSOBBCipher; -use elseware::pktvec; -use elseware::common::pktvec::PktVec; use elseware::common::cipherkeys::{ELSEWHERE_PRIVATE_KEY, ELSEWHERE_PARRAY}; use elseware::common::network::{PacketNetworkError}; use elseware::common::client::Client; diff --git a/src/login/login.rs b/src/login/login.rs index b7e36bb..f2c86c9 100644 --- a/src/login/login.rs +++ b/src/login/login.rs @@ -10,8 +10,7 @@ use libpso::{PacketParseError, PSOPacket}; use libpso::crypto::{CipherError, PSOCipher, NullCipher}; use libpso::crypto::bb::PSOBBCipher; -use elseware::{pktvec, utf8_to_array}; -use elseware::common::pktvec::PktVec; +use elseware::utf8_to_array; use elseware::common::cipherkeys::{ELSEWHERE_PRIVATE_KEY, ELSEWHERE_PARRAY}; //use elseware::common::network::{PacketNetworkError}; use elseware::common::client::Client;