pub struct Sender { /* private fields */ }Expand description
A handle other threads use to post custom events to the UI thread.
Get one with Engine::sender; clone it freely and move it into threads. Posting is
thread-safe: the payload is queued and the run loop is woken, then delivers it on the UI thread
as an Event::Custom with no source.
§Examples
use pushrod::engine::Engine;
use pushrod::event::EventTarget;
use pushrod::geometry::size;
struct Progress(u8);
let engine: Engine = Engine::new(size(320, 200), 30);
let sender = engine.sender();
std::thread::spawn(move || sender.post(EventTarget::ApplicationOnly, Progress(40)))
.join()
.unwrap();Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sender
impl RefUnwindSafe for Sender
impl Send for Sender
impl Sync for Sender
impl Unpin for Sender
impl UnsafeUnpin for Sender
impl UnwindSafe for Sender
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