Rename ControlFlow variant from Complete to Break

This commit is contained in:
mitchmindtree 2017-06-20 21:25:53 +10:00
parent df1276d72a
commit 04ccad1dbc
13 changed files with 28 additions and 28 deletions

View file

@ -23,7 +23,7 @@ fn main() {
}
},
Event::WindowEvent { event: WindowEvent::Closed, .. } => {
return ControlFlow::Complete;
return ControlFlow::Break;
},
_ => ()
}

View file

@ -37,10 +37,10 @@ fn main() {
match event {
Event::WindowEvent { event, .. } => {
match event {
WindowEvent::Closed => return ControlFlow::Complete,
WindowEvent::Closed => return ControlFlow::Break,
WindowEvent::KeyboardInput {
input: winit::KeyboardInput { virtual_keycode: Some(winit::VirtualKeyCode::Escape), .. }, ..
} => return ControlFlow::Complete,
} => return ControlFlow::Break,
_ => ()
}
},

View file

@ -28,7 +28,7 @@ fn main() {
}
},
WindowEvent::Closed => return ControlFlow::Complete,
WindowEvent::Closed => return ControlFlow::Break,
a @ WindowEvent::MouseMoved { .. } => {
println!("{:?}", a);

View file

@ -13,7 +13,7 @@ fn main() {
println!("{:?}", event);
match event {
winit::Event::WindowEvent { event: winit::WindowEvent::Closed, .. } => winit::ControlFlow::Complete,
winit::Event::WindowEvent { event: winit::WindowEvent::Closed, .. } => winit::ControlFlow::Break,
_ => winit::ControlFlow::Continue,
}
});

View file

@ -24,7 +24,7 @@ fn main() {
num_windows -= 1;
if num_windows == 0 {
return winit::ControlFlow::Complete;
return winit::ControlFlow::Break;
}
},
_ => (),

View file

@ -22,7 +22,7 @@ fn main() {
println!("{:?}", event);
match event {
winit::Event::WindowEvent { event: winit::WindowEvent::Closed, .. } =>
winit::ControlFlow::Complete,
winit::ControlFlow::Break,
_ => winit::ControlFlow::Continue,
}
});

View file

@ -13,7 +13,7 @@ fn main() {
println!("{:?}", event);
match event {
winit::Event::WindowEvent { event: winit::WindowEvent::Closed, .. } => winit::ControlFlow::Complete,
winit::Event::WindowEvent { event: winit::WindowEvent::Closed, .. } => winit::ControlFlow::Break,
_ => winit::ControlFlow::Continue,
}
});

View file

@ -13,7 +13,7 @@ fn main() {
match event {
winit::Event::WindowEvent { event: winit::WindowEvent::Closed, .. } => {
winit::ControlFlow::Complete
winit::ControlFlow::Break
},
_ => winit::ControlFlow::Continue,
}

View file

@ -52,11 +52,11 @@ macro_rules! gen_api_transition {
loop {
let mut control_flow = ::ControlFlow::Continue;
self.poll_events(|e| {
if let ::ControlFlow::Complete = callback(e) {
control_flow = ::ControlFlow::Complete;
if let ::ControlFlow::Break = callback(e) {
control_flow = ::ControlFlow::Break;
}
});
if let ::ControlFlow::Complete = control_flow {
if let ::ControlFlow::Break = control_flow {
break;
}
::std::thread::sleep(::std::time::Duration::from_millis(5));

View file

@ -51,7 +51,7 @@
//! ```
//!
//! The second way is to call `events_loop.run_forever(...)`. As its name tells, it will run
//! forever unless it is stopped by returning `ControlFlow::Complete`.
//! forever unless it is stopped by returning `ControlFlow::Break`.
//!
//! ```no_run
//! use winit::{ControlFlow, Event, WindowEvent};
@ -62,7 +62,7 @@
//! match event {
//! Event::WindowEvent { event: WindowEvent::Closed, .. } => {
//! println!("The window was closed ; stopping");
//! ControlFlow::Complete
//! ControlFlow::Break
//! },
//! _ => ControlFlow::Continue,
//! }
@ -143,7 +143,7 @@ pub mod os;
/// events_loop.run_forever(|event| {
/// match event {
/// Event::WindowEvent { event: WindowEvent::Closed, .. } => {
/// ControlFlow::Complete
/// ControlFlow::Break
/// },
/// _ => ControlFlow::Continue,
/// }
@ -192,8 +192,8 @@ pub struct EventsLoop {
pub enum ControlFlow {
/// Continue looping and waiting for events.
Continue,
/// Exit from the event loop.
Complete,
/// Break from the event loop.
Break,
}
impl EventsLoop {

View file

@ -226,8 +226,8 @@ impl EventsLoop {
// Check for control flow by wrapping the callback.
let control_flow = ::std::cell::Cell::new(ControlFlow::Continue);
let callback = |event| if let ControlFlow::Complete = callback(event) {
control_flow.set(ControlFlow::Complete);
let callback = |event| if let ControlFlow::Break = callback(event) {
control_flow.set(ControlFlow::Break);
};
// set the callback into the sink
@ -251,7 +251,7 @@ impl EventsLoop {
self.prune_dead_windows()
}
if let ControlFlow::Complete = control_flow.get() {
if let ControlFlow::Break = control_flow.get() {
break;
}
}

View file

@ -163,18 +163,18 @@ impl EventsLoop {
let mut control_flow = ControlFlow::Continue;
// Track whether or not `Complete` was returned when processing the event.
// Track whether or not `Break` was returned when processing the event.
{
let mut cb = |event| {
if let ControlFlow::Complete = callback(event) {
control_flow = ControlFlow::Complete;
if let ControlFlow::Break = callback(event) {
control_flow = ControlFlow::Break;
}
};
self.process_event(&mut xev, &mut cb);
}
if let ControlFlow::Complete = control_flow {
if let ControlFlow::Break = control_flow {
break;
}
}

View file

@ -222,8 +222,8 @@ impl EventsLoop {
let control_flow = std::cell::Cell::new(ControlFlow::Continue);
let mut callback = |event| {
if let ControlFlow::Complete = callback(event) {
control_flow.set(ControlFlow::Complete);
if let ControlFlow::Break = callback(event) {
control_flow.set(ControlFlow::Break);
}
};
@ -233,7 +233,7 @@ impl EventsLoop {
unsafe {
// First, yield all pending events.
self.shared.call_user_callback_with_pending_events();
if let ControlFlow::Complete = control_flow.get() {
if let ControlFlow::Break = control_flow.get() {
break;
}
@ -254,7 +254,7 @@ impl EventsLoop {
if let Some(event) = maybe_event {
self.shared.user_callback.call_with_event(event);
if let ControlFlow::Complete = control_flow.get() {
if let ControlFlow::Break = control_flow.get() {
break;
}
}