pub struct Threaded<S> where
S: ActorState + Send,
S::Event: Send,
<S::Outcome as Outcome>::Commands: Send, {
thread: Sender<S::Event>,
}
Expand description
This loop driver spawns a new thread which updates the state in a loop,
in response to incoming events.
It sends outcomes to the glib main loop using a channel.
The outcomes are applied by the UI end of the channel in the main
module.
by creating a glib::Sender and checking what messages it receives.
Fields
thread: Sender<S::Event>
Waits for external events
Implementations
sourceimpl<S> Threaded<S> where
S: ActorState + Send + 'static,
S::Event: Send,
<S::Outcome as Outcome>::Commands: Send,
impl<S> Threaded<S> where
S: ActorState + Send + 'static,
S::Event: Send,
<S::Outcome as Outcome>::Commands: Send,
pub fn new(
ui: Sender<<<S as ActorState>::Outcome as Outcome>::Commands>,
initial_state: S
) -> Self
pub fn send(&self, event: S::Event) -> Result<(), SendError<S::Event>>
fn handle_loop_event(
loop_sender: &Sender<S::Event>,
state: State<S>,
event: S::Event,
ui: &Sender<<<S as ActorState>::Outcome as Outcome>::Commands>
) -> State<S>
fn schedule_timeout_wake(loop_sender: &Sender<S::Event>, when: Instant)
Trait Implementations
Auto Trait Implementations
impl<S> !RefUnwindSafe for Threaded<S>
impl<S> Send for Threaded<S>
impl<S> !Sync for Threaded<S>
impl<S> Unpin for Threaded<S>
impl<S> !UnwindSafe for Threaded<S>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more