pub struct ProjectionController<M: Motor + Send + 'static> {
pub motor: Arc<Mutex<M>>,
/* private fields */
}Expand description
Orchestrates the synchronization between motor and display.
Fields§
§motor: Arc<Mutex<M>>Implementations§
Source§impl<M: Motor + Send + 'static> ProjectionController<M>
impl<M: Motor + Send + 'static> ProjectionController<M>
pub fn new(motor: M, projections: Array3<f32>, angles: Vec<f32>) -> Self
Sourcepub fn get_frame_index(&self, current_angle: f32) -> usize
pub fn get_frame_index(&self, current_angle: f32) -> usize
Finds the closest projection frame index for a given motor angle.
Sourcepub fn spawn_sync_thread(&self, stop_signal: Arc<AtomicBool>)
pub fn spawn_sync_thread(&self, stop_signal: Arc<AtomicBool>)
Spawns a background thread to poll the motor and update the shared frame index.
pub fn poll_and_render(&mut self, window: &ProjectionWindow) -> Result<()>
pub fn run_sync_loop(&mut self) -> Result<()>
Auto Trait Implementations§
impl<M> Freeze for ProjectionController<M>
impl<M> RefUnwindSafe for ProjectionController<M>
impl<M> Send for ProjectionController<M>
impl<M> Sync for ProjectionController<M>
impl<M> Unpin for ProjectionController<M>
impl<M> UnwindSafe for ProjectionController<M>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.