I have QT UI app (using qml-rust). It scans radio spectrum and produces charts.
The scanning process can last for several minutes and I want to repaint the chart every couple of seconds.
I can not figure out how do I go about my measures vector ownership. As the app is driven by user pressing a button, usual scope driven ownership does not work because user can press “scan” button any moment.
But than problem becomes more interesting, because I want to access measures vector from 2 threads: scanning thread to append measures every 16ms and chart thread reading the measures every 2sec.
So my thinking is: I need top pass reference to measures to 2 threads, which means Rc or Arc. I want to prevent simultaneous vector appending and reading so I need a Mutex. So what I am looking at is “Arc<Mutex<Vec>>” ? Am I heading right direction?