Trait fp_rust::handler::Handler [−][src]
pub trait Handler: Send + Sync + 'static { fn is_started(&mut self) -> bool; fn is_alive(&mut self) -> bool; fn start(&mut self); fn stop(&mut self); fn post(&mut self, func: RawFunc); }
Handler
trait
defines the interface which could receive FnMut
and run them on its own thread
.
Remarks
This is highly inspired by Android Handler
concepts.
Required Methods
fn is_started(&mut self) -> bool
Did this Handler
start?
Return true
when it did started (no matter it has stopped or not)
fn is_alive(&mut self) -> bool
Is this Handler
alive?
Return true
when it has started and not stopped yet.
fn start(&mut self)
Start Handler
.
fn stop(&mut self)
Stop Cor
.
This will make self.is_alive
() returns false
,
and all FnMut
posted by self.post
() will not be executed.
(Because it has stopped :P, that's reasonable)
fn post(&mut self, func: RawFunc)
Implementors
impl Handler for HandlerThread