aboutsummaryrefslogtreecommitdiffstats
path: root/src/trace.rs
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2025-12-16 17:36:57 +0000
committers-ol <s+removethis@s-ol.nu>2025-12-16 17:36:57 +0000
commitc03281d1f8f856cfc68c2b06dede6b7306b4fea5 (patch)
treeee7d10732669bcfb71e9c4ce240c00f8407231fb /src/trace.rs
parentGetting closer to no-std being done (diff)
downloadmeshcore-rs-main.tar.gz
meshcore-rs-main.zip
run cargo fmtHEADmain
Diffstat (limited to 'src/trace.rs')
-rw-r--r--src/trace.rs34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/trace.rs b/src/trace.rs
index 3770702..b25aad7 100644
--- a/src/trace.rs
+++ b/src/trace.rs
@@ -9,7 +9,7 @@ pub struct Trace {
pub(crate) path_snr: ArrayVec<[f32; 64]>,
invalid: bool,
- pub(crate) temp_path: ArrayVec<[u16; 64]>
+ pub(crate) temp_path: ArrayVec<[u16; 64]>,
}
impl From<Bytes> for Trace {
@@ -25,17 +25,19 @@ impl From<Bytes> for Trace {
temp_path: ArrayVec::new(),
};
- if bytes.len() < 10 { return trace; }
+ if bytes.len() < 10 {
+ return trace;
+ }
- trace.tag = bytes.get_u32();
- trace.auth = bytes.get_u32();
- trace.flags = bytes.get_u8();
+ trace.tag = bytes.get_u32();
+ trace.auth = bytes.get_u32();
+ trace.flags = bytes.get_u8();
for byte in bytes.iter() {
trace.temp_path.push(*byte as u16);
}
- trace.invalid = false;
+ trace.invalid = false;
trace
}
}
@@ -53,13 +55,12 @@ impl core::fmt::Display for Trace {
// Tests for std operations
#[cfg(test)]
mod tests {
+ use crate::{packet::*, packet_content::PacketContent};
use core::str::FromStr;
use hex::decode;
use tinyvec::array_vec;
- use crate::{packet::*, packet_content::PacketContent};
-
- use super::*;
+ use super::*;
#[test]
fn trace() {
@@ -78,9 +79,8 @@ mod tests {
path_snr: array_vec!([f32; 64] => 11.0, -8.0, -3.75),
invalid: false,
temp_path: array_vec!([u16; 64] => 0xAC, 0xA0, 0x79),
- }
- ),
- incomplete: false
+ }),
+ incomplete: false,
};
let rhs_packet = Packet::from_str(sample).unwrap();
@@ -88,9 +88,9 @@ mod tests {
// We can only check the description in std mode
#[cfg(feature = "std")]
- assert_eq!(format!("{}", rhs_packet), " Direct | v1 | | [ac, a0, 79] | | TRACE | (ac): 11dB (a0): -8dB (79): -3.75dB ")
-
+ assert_eq!(
+ format!("{}", rhs_packet),
+ " Direct | v1 | | [ac, a0, 79] | | TRACE | (ac): 11dB (a0): -8dB (79): -3.75dB "
+ )
}
-
-
-} \ No newline at end of file
+}