diff --git a/build.rs b/build.rs index be0bb126..4a65370c 100644 --- a/build.rs +++ b/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})",) - } -} diff --git a/src/networking/types/service_query.rs b/src/networking/types/service_query.rs index 79512f44..716113ed 100644 --- a/src/networking/types/service_query.rs +++ b/src/networking/types/service_query.rs @@ -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})",) + } +}