pub struct SingletonThread { /* private fields */ }Implementations§
Source§impl SingletonThread
impl SingletonThread
Sourcepub fn newFiltered(
mainFn: impl Fn() + Send + Sync + 'static,
filterFn: impl Fn() -> bool + Send + Sync + 'static,
) -> Self
pub fn newFiltered( mainFn: impl Fn() + Send + Sync + 'static, filterFn: impl Fn() -> bool + Send + Sync + 'static, ) -> Self
create a new singletonThread with a filter. filter is run each time, after testing if the thread is running or not, filter must return true if the thread can be launched, or false if not
Sourcepub fn thread_launch(&mut self) -> bool
pub fn thread_launch(&mut self) -> bool
try to launch a new run, check if not running AND the filter function return true return if the thread have been launched
Sourcepub fn thread_launch_delayabe(&mut self)
pub fn thread_launch_delayabe(&mut self)
try to launch a new run, check if not running, AND the filter function returns true if it cannot be launched immediately, mark the class to run another time after the current one. can only mark one time.
Sourcepub fn duration_set(&mut self, duration: Duration)
pub fn duration_set(&mut self, duration: Duration)
minimum duration before another run can occur, default 1ns
Sourcepub fn duration_setFPS(&mut self, fps: u8)
pub fn duration_setFPS(&mut self, fps: u8)
minimum duration before another run can occur from frame per second (60 fps = 16.666 ms), minimum 1 fps (1 ms)
Sourcepub fn loop_set(&mut self, canLoop: bool)
pub fn loop_set(&mut self, canLoop: bool)
define if the thread auto relaunch himself (technically it just use the same thread) set to false if you want to stop a looped thread that running.
Sourcepub fn thread_setName(&mut self, name: impl Into<String>)
pub fn thread_setName(&mut self, name: impl Into<String>)
set the name of the thread. the name is updated only if the thread launch is completely relaunched (no change when a loop ends)
Sourcepub fn thread_getName(&mut self) -> &Option<String>
pub fn thread_getName(&mut self) -> &Option<String>
get the name of the thread