File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ pub trait WindowHandler: 'static {
8686 /// The goal is for all external update logic to be contained within this method.
8787 /// Therefore, this method will be called in various cases, including (but not limited to):
8888 ///
89- /// * As a result of calling [`Window::request_poll`], at the platform's earliest convenience;
89+ /// * As a result of calling [`Window::request_poll`] or [`WindowWaker::request_poll`] , at the platform's earliest convenience;
9090 /// * Whenever a new frame has been scheduled, right before actually calling [`WindowHandler::draw`].
9191 ///
9292 /// This all means that this method will be invoked very regularly, possibly multiple times per frame interval.
Original file line number Diff line number Diff line change 11use std:: time:: Duration ;
22
3+ /// A simple, weak handle to the [`Window`](crate::Window), which can be used to "wake" it from
4+ /// external events or threads.
5+ ///
6+ /// It can be cheaply [cloned](Clone) and [send](Send) to be used from other threads with minimal
7+ /// overhead.
38#[ derive( Clone ) ]
49pub struct WindowWaker {
510 pub ( crate ) inner : crate :: platform:: WindowWaker ,
@@ -12,14 +17,18 @@ const _: () = {
1217} ;
1318
1419impl WindowWaker {
20+ /// Schedules a new frame to be drawn.
1521 pub fn request_redraw ( & self ) {
1622 self . inner . request_redraw ( )
1723 }
1824
25+ /// Schedules a new frame to be drawn after the given `duration`.
1926 pub fn request_redraw_after ( & self , duration : Duration ) {
2027 self . inner . request_redraw_after ( duration)
2128 }
2229
30+ /// Schedules a call to the [`WindowHandler::poll`](crate::WindowHandler::poll) callback, at
31+ /// the platform's earliest convenience.
2332 pub fn request_poll ( & self ) {
2433 self . inner . request_poll ( )
2534 }
You can’t perform that action at this time.
0 commit comments