Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
root-hunter committed Nov 17, 2024
1 parent f12f361 commit cf89ffb
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/engine.rs → src/engine/data.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use rustc_hash::FxHashMap;

const DATA_EXPORT_U8: u8 = 0x0000;
const DATA_EXPORT_U16: u8 = 0x0001;
const DATA_EXPORT_U32: u8 = 0x0002;
const DATA_EXPORT_USIZE: u8 = 0x0003;
const DATA_EXPORT_U8: u8 = 0x00;
const DATA_EXPORT_U16: u8 = 0x01;
const DATA_EXPORT_U32: u8 = 0x02;
const DATA_EXPORT_USIZE: u8 = 0x03;

trait AllowedExportTypes {}

Expand Down Expand Up @@ -78,7 +78,7 @@ impl Export<u8> for DataExport<u8> {
for (k, v) in self.extra_separators {
extra_separators.insert(k, v as u16);
}

return Data {
length,
tokens,
Expand Down
Empty file added src/engine/mod.rs
Empty file.
7 changes: 5 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
use engine::Data;
pub mod engine {
pub mod data;
}

pub mod engine;
use engine::data::Data;

const SEPARATOR: char = ' ';

pub fn compress(path: &str, buf: &[u8]) {

let mut data = Data::new();
let str = std::str::from_utf8(buf).unwrap();

Expand Down
6 changes: 2 additions & 4 deletions tests/engine.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use chrono::Local;
use env_logger::Builder;
use log::{info, warn, LevelFilter};
use log::{info, LevelFilter};
use std::fs::File;
use std::io::Write;

Expand Down Expand Up @@ -39,7 +39,7 @@ fn init_logger() {
mod tests {
use super::*;
use std::fs::File;
use std::io::{self, Read};
use std::io::Read;

use crate::init_logger;

Expand All @@ -50,11 +50,9 @@ mod tests {
let mut file1_contents = Vec::new();
let mut file2_contents = Vec::new();

// Read the contents of both files into byte vectors
file1.read_to_end(&mut file1_contents).unwrap();
file2.read_to_end(&mut file2_contents).unwrap();

// Compare the contents byte by byte
Ok(file1_contents == file2_contents)
}

Expand Down
2 changes: 1 addition & 1 deletion tests/inputs/input_5.txt
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ struct rxq {
* @pdev: pci device
* @hdev: hdev device
* @flags: driver state
* @irq_lock: spinlock for MSI-X
* @irq_lock: spinl ock for MSI-X
* @hci_rx_lock: spinlock for HCI RX flow
* @base_addr: pci base address (from BAR)
* @msix_entries: array of MSI-X entries
Expand Down

0 comments on commit cf89ffb

Please sign in to comment.