Apply rustfmt

The drift was 94 hunks across 4 files, not 94 files as I described it earlier.
muninn-daemon carries almost all of it; sleipnir-daemon needed four lines.

Checked rather than assumed. Ignoring whitespace, the only remaining deltas are
trailing commas rustfmt adds when it wraps an argument list, and braces removed
from single-expression closure bodies. Both are semantics-preserving.
sleipnir-daemon's change is whitespace and nothing else.

Everything except the Unix-only odin-daemon builds; muninn and sleipnir pass 162
tests, with the same pre-existing media-channel failure.

vendor/cultmesh-rs is its own workspace so `cargo fmt` does not reach it, but it
reports no drift of its own.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-04 15:28:32 +02:00
commit 3d939a8523
4 changed files with 728 additions and 270 deletions

File diff suppressed because it is too large Load diff

View file

@ -166,19 +166,29 @@ mod linux {
}
let serial = unsafe { text(psmove_get_serial(handle)) };
let move_id = format!("move-{}", serial.replace(':', "").to_ascii_lowercase());
if self.controllers.iter().any(|controller| controller.move_id == move_id) {
if self
.controllers
.iter()
.any(|controller| controller.move_id == move_id)
{
unsafe { psmove_disconnect(handle) };
continue;
}
let Some((_, color)) = self.colors.iter().find(|(identity, _)| {
identity.eq_ignore_ascii_case(&move_id)
}) else {
let Some((_, color)) = self
.colors
.iter()
.find(|(identity, _)| identity.eq_ignore_ascii_case(&move_id))
else {
unsafe { psmove_disconnect(handle) };
continue;
};
let status = unsafe {
psmove_tracker_enable_color_observer(
self.tracker, handle, color[0], color[1], color[2]
self.tracker,
handle,
color[0],
color[1],
color[2],
)
};
if status == TRACKER_CALIBRATED {
@ -192,9 +202,11 @@ mod linux {
}
pub fn set_expected_color(&mut self, move_id: &str, color: [u8; 3]) -> bool {
let Some(controller) = self.controllers.iter().find(|controller| {
controller.move_id.eq_ignore_ascii_case(move_id)
}) else {
let Some(controller) = self
.controllers
.iter()
.find(|controller| controller.move_id.eq_ignore_ascii_case(move_id))
else {
return false;
};
unsafe {
@ -275,7 +287,9 @@ mod linux {
if value.is_null() {
return String::new();
}
unsafe { CStr::from_ptr(value) }.to_string_lossy().into_owned()
unsafe { CStr::from_ptr(value) }
.to_string_lossy()
.into_owned()
}
}
@ -301,20 +315,29 @@ impl PsmoveApiTracker {
unreachable!()
}
pub fn calibrate_connected(&mut self) -> usize { 0 }
pub fn calibrate_connected(&mut self) -> usize {
0
}
pub fn observe_connected(&mut self) -> usize { 0 }
pub fn observe_connected(&mut self) -> usize {
0
}
pub fn set_expected_color(&mut self, _move_id: &str, _color: [u8; 3]) -> bool { false }
pub fn set_expected_color(&mut self, _move_id: &str, _color: [u8; 3]) -> bool {
false
}
pub fn tracked_controller_count(&self) -> usize { 0 }
pub fn tracked_controller_count(&self) -> usize {
0
}
pub fn update(&mut self) -> Vec<PsmoveApiObservation> {
Vec::new()
}
pub fn rgb_image(&self) -> Option<(u32, u32, Vec<u8>)> { None }
pub fn rgb_image(&self) -> Option<(u32, u32, Vec<u8>)> {
None
}
}
#[cfg(test)]

View file

@ -1,6 +1,8 @@
use anyhow::{Context, Result};
use cultmesh_rs::{CultMesh, CultMeshNodeOptions};
use odin_core::{MuninnMoveEvidenceTransportHealthRecord, MuninnMoveTrackerHealthRecord, OdinDocuments};
use odin_core::{
MuninnMoveEvidenceTransportHealthRecord, MuninnMoveTrackerHealthRecord, OdinDocuments,
};
use std::{env, path::PathBuf};
fn main() -> Result<()> {
@ -42,16 +44,29 @@ fn main() -> Result<()> {
record.last_observation_at,
record.image_mean_rgb,
record.image_peak_rgb,
record.color_evidence_move_ids.iter().cloned().zip(record.color_evidence_pixel_counts.iter().copied()).collect::<Vec<_>>(),
record
.color_evidence_move_ids
.iter()
.cloned()
.zip(record.color_evidence_pixel_counts.iter().copied())
.collect::<Vec<_>>(),
record.updated_at,
record.detail,
);
}
for record in node.cache().get_all::<MuninnMoveEvidenceTransportHealthRecord>().unwrap_or_default() {
for record in node
.cache()
.get_all::<MuninnMoveEvidenceTransportHealthRecord>()
.unwrap_or_default()
{
println!(
"stream={} produced={} local_admitted={} remote_handoffs={} remote_sends={} updated={}",
record.stream_id, record.produced_frames, record.local_ring_admissions,
record.remote_handoffs, record.remote_sends, record.updated_at,
record.stream_id,
record.produced_frames,
record.local_ring_admissions,
record.remote_handoffs,
record.remote_sends,
record.updated_at,
);
}
Ok(())

View file

@ -2227,7 +2227,7 @@ fn create_rudp_stream(
max_fragment_bytes: Some(HID_RUDP_MAX_FRAGMENT_BYTES),
max_pending_reliable_packets: Some(256),
media_reliable_expire_after_ms: Some(25),
reconnect_policy: None,
reconnect_policy: None,
})?;
transport.connect(Vec::new())?;
return Ok(Some(ActiveRudpStream {
@ -2268,7 +2268,7 @@ fn create_rudp_stream(
max_fragment_bytes: Some(HID_RUDP_MAX_FRAGMENT_BYTES),
max_pending_reliable_packets: Some(256),
media_reliable_expire_after_ms: Some(25),
reconnect_policy: None,
reconnect_policy: None,
})?,
target: None,
last_connect_attempt_at: None,