RustyLee: Starts Heart organ processing

Activates the Heart organ's main command processing loop by calling its `start` method.

Replaces the previous placeholder `run_loop` method with the functional `start` method. The `start` method now takes a mutable reference to `self`, which enables it to operate as a long-running process without consuming the `Heart` instance.
This commit is contained in:
Russell Gilbert 2026-03-13 15:55:19 +00:00
parent 7633985535
commit dbb52ccbb2
2 changed files with 4 additions and 12 deletions

View file

@ -10,12 +10,6 @@ pub struct Heart {
feedback_to_brain_tx: mpsc::Sender<BrainMessage>,
}
impl Heart {
pub(crate) fn run_loop(&mut self) {
todo!()
}
}
impl Heart {
pub(crate) fn new(id: u32, rx: Receiver<OrganCommandEnvelope>, tx: Sender<BrainMessage>) -> Self {
Self {
@ -24,11 +18,9 @@ impl Heart {
feedback_to_brain_tx: tx,
}
}
}
impl Heart {
#[instrument(skip(self), fields(heart_id = self.id))]
pub fn start(self) {
pub fn start(&mut self) {
info!("Heart listener active");
while let Ok(envelope) = self.brain_command_rx.recv() {

View file

@ -44,7 +44,7 @@ impl OrganFactory {
thread::spawn(move || {
let mut heart = Heart::new(id, brain_command_to_organ_rx, feedback_to_brain_tx);
heart.run_loop();
heart.start();
});
socket