pub struct MainLoop { /* private fields */ }
Implementations§
Source§impl MainLoop
impl MainLoop
Sourcepub fn new(cx: Option<&MainContext>) -> MainLoop
pub fn new(cx: Option<&MainContext>) -> MainLoop
Creates a new event loop using the provided context.
If None
is provided then the default context will be used.
Sourcepub fn run(&self)
pub fn run(&self)
Runs a main loop until quit
is called on the loop.
If this is called for the thread of the loop’s MainContext
, it will
process events from the loop, otherwise it will simply wait.
Sourcepub fn quit(&self)
pub fn quit(&self)
Stops a MainLoop
from running. Any calls to run
for the
loop will return.
Note that sources that have already been dispatched when
quit
is called will still be executed.
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Checks to see if the main loop is currently being run via
run
.
Sourcepub fn context(&self) -> MainContext
pub fn context(&self) -> MainContext
Returns the context of this loop.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MainLoop
impl RefUnwindSafe for MainLoop
impl !Send for MainLoop
impl !Sync for MainLoop
impl Unpin for MainLoop
impl UnwindSafe for MainLoop
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