Struct display_link::DisplayLink
source · pub struct DisplayLink(_);Expand description
DisplayLink is a timer object used to synchronize drawing with the refresh rate of the
display.
Implementations§
source§impl DisplayLink
impl DisplayLink
sourcepub fn new<F>(callback: F) -> Option<Self>where
F: 'static + FnMut(Instant) + Send,
pub fn new<F>(callback: F) -> Option<Self>where
F: 'static + FnMut(Instant) + Send,
Creates a new DisplayLink with a callback that will be invoked with the Instant the
screen will next refresh.
The returned DisplayLink will be in a paused state. Returns None if a DisplayLink
could not be created.
Panic
If the callback panics, the process will be aborted.
sourcepub fn pause(&mut self) -> Result<(), PauseError>
pub fn pause(&mut self) -> Result<(), PauseError>
Pauses the DisplayLink.
A paused DisplayLink will not invoke it’s callback. On iOS, it is necessary to pause the
DisplayLink in response to events like backgrounding.
sourcepub fn resume(&mut self) -> Result<(), ResumeError>
pub fn resume(&mut self) -> Result<(), ResumeError>
Resumes the DisplayLink.