refactor: get rid of smallvec
Doesn't seem to be doing much.
This commit is contained in:
@@ -7,7 +7,6 @@ use azalea::{
|
||||
};
|
||||
use log::debug;
|
||||
use serde_json::json;
|
||||
use smallvec::SmallVec;
|
||||
use std::{
|
||||
fs::File,
|
||||
io::Write,
|
||||
@@ -69,16 +68,16 @@ impl Recorder {
|
||||
}
|
||||
|
||||
pub fn save_raw_packet(&mut self, raw_packet: &[u8]) -> Result<()> {
|
||||
let mut data = SmallVec::<[u8; 128]>::with_capacity(raw_packet.len() + 8);
|
||||
data.write_all(&TryInto::<u32>::try_into(self.start.elapsed().as_millis())?.to_be_bytes())?;
|
||||
data.write_all(&TryInto::<u32>::try_into(raw_packet.len())?.to_be_bytes())?;
|
||||
data.write_all(raw_packet)?;
|
||||
let mut data = Vec::with_capacity(raw_packet.len() + 8);
|
||||
data.extend(TryInto::<u32>::try_into(self.start.elapsed().as_millis())?.to_be_bytes());
|
||||
data.extend(TryInto::<u32>::try_into(raw_packet.len())?.to_be_bytes());
|
||||
data.extend(raw_packet);
|
||||
self.zip_writer.write_all(&data)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn save_packet<T: ProtocolPacket>(&mut self, packet: &T) -> Result<()> {
|
||||
let mut raw_packet = SmallVec::<[u8; 128]>::new();
|
||||
let mut raw_packet = Vec::with_capacity(64);
|
||||
packet.id().azalea_write_var(&mut raw_packet)?;
|
||||
packet.write(&mut raw_packet)?;
|
||||
self.save_raw_packet(&raw_packet)
|
||||
|
Reference in New Issue
Block a user