mirror of
https://github.com/GyulyVGC/sniffnet.git
synced 2025-12-23 22:29:01 -05:00
minor improvements
This commit is contained in:
14
build.rs
14
build.rs
@@ -8,9 +8,12 @@
|
||||
|
||||
include!("./src/networking/types/service_query.rs");
|
||||
include!("./src/networking/types/protocol.rs");
|
||||
include!("./src/networking/types/service.rs");
|
||||
|
||||
const SERVICES_LIST_PATH: &str = "./services.txt";
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed={SERVICES_LIST_PATH}");
|
||||
|
||||
set_icon();
|
||||
build_services_phf();
|
||||
}
|
||||
@@ -30,7 +33,7 @@ fn build_services_phf() {
|
||||
|
||||
let mut services_map = phf_codegen::Map::new();
|
||||
|
||||
let input = BufReader::new(File::open("./services.txt").unwrap());
|
||||
let input = BufReader::new(File::open(SERVICES_LIST_PATH).unwrap());
|
||||
for line_res in input.lines() {
|
||||
// we want to panic if one of the lines is err...
|
||||
let line = line_res.unwrap();
|
||||
@@ -77,10 +80,3 @@ fn get_valid_service_query(s: &str) -> ServiceQuery {
|
||||
assert!(parts.next().is_none());
|
||||
ServiceQuery(port, protocol)
|
||||
}
|
||||
|
||||
impl phf_shared::FmtConst for ServiceQuery {
|
||||
fn fmt_const(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let ServiceQuery(port, protocol) = self;
|
||||
write!(f, "ServiceQuery({port}, Protocol::{protocol})",)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,3 +17,10 @@ fn borrow(&self) -> &ServiceQuery {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl phf_shared::FmtConst for ServiceQuery {
|
||||
fn fmt_const(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let ServiceQuery(port, protocol) = self;
|
||||
write!(f, "ServiceQuery({port}, Protocol::{protocol})",)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user