pub struct EventProxy(/* private fields */);Expand description
A thread-safe handle for injecting Event::Custom events into a running windowed event
loop from another thread (network, audio, timer, …).
Obtained via the on_proxy callback passed to run_windowed_with_proxy/
run_app_with_proxy, invoked synchronously right after the event loop (and this proxy) is
created, before the loop starts blocking the calling thread. Clone it freely to hand a copy to
each worker thread that needs to wake the loop; wraps winit’s own
EventLoopProxy, which is Send + Sync for any
'static payload, including u64.
Implementations§
Source§impl EventProxy
impl EventProxy
Sourcepub fn send_event(&self, id: u64) -> Result<(), EventProxyClosed>
pub fn send_event(&self, id: u64) -> Result<(), EventProxyClosed>
Injects id as Event::Custom(id) into the event loop’s queue, waking
it if it’s asleep. The event surfaces through the app’s normal poll_event/frame loop
like any other Event.
§Errors
Returns EventProxyClosed if the event loop has already exited.
Trait Implementations§
Source§impl Clone for EventProxy
impl Clone for EventProxy
Source§fn clone(&self) -> EventProxy
fn clone(&self) -> EventProxy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for EventProxy
impl RefUnwindSafe for EventProxy
impl Send for EventProxy
impl Sync for EventProxy
impl Unpin for EventProxy
impl UnsafeUnpin for EventProxy
impl UnwindSafe for EventProxy
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.