[fp-rs] Making some values const rather than static or inlined.

This commit is contained in:
Lucas Silva Shepard
2023-08-18 17:49:34 -07:00
parent d89d1af459
commit 90812bfe73
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -124,6 +124,8 @@ fn init_cache() {
/// Sets up initial constructs and infinitely polls for advertisements.
pub fn init() {
const JSON_PATH: &str = "./local";
let run = async {
info!("start making adapter");
@@ -134,7 +136,7 @@ pub fn init() {
let mut latest_advertisement_map = HashMap::new();
let datatype_selector = vec![BleDataTypeId::ServiceData16BitUuid];
let fetcher: Box<dyn FpFetcher> = Box::new(FpFetcherFs::new(String::from("./local")));
let fetcher: Box<dyn FpFetcher> = Box::new(FpFetcherFs::new(String::from(JSON_PATH)));
loop {
// Retrieve the next received advertisement.
+1 -1
View File
@@ -28,7 +28,7 @@ impl FpDecoder {
pub(crate) fn get_model_id_from_service_data<U: Copy>(
service_data: &ServiceData<U>,
) -> Result<Vec<u8>, FpError> {
static MIN_MODEL_ID_LENGTH: usize = 3;
const MIN_MODEL_ID_LENGTH: usize = 3;
let data = service_data.data();
if data.len() < MIN_MODEL_ID_LENGTH {