pub struct SingletonThread { /* private fields */ }

Implementations§

source§

impl SingletonThread

source

pub fn new(mainFn: impl Fn() + Send + Sync + 'static) -> Self

create a new singletonThread

source

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 thread is running or not filter must return true if the thread can be launched, or false if not

source

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

source

pub fn setDuration(&mut self, duration: Duration)

minimum duration before another run can occur, default 166ms (60fps)

source

pub fn setDuration_FPS(&mut self, fps: u8)

minimum duration before another run can occur, default 166ms (60fps)

source

pub fn setLoop(&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.

source

pub fn setThreadName(&mut self, name: impl Into<String>)

source

pub fn setThreadPriority(&mut self, priority: ThreadPriority)

Trait Implementations§

source§

impl Drop for SingletonThread

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.