1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-10 15:04:32 +03:00

make it possible to build async example on stable rust

This should make the CI a bit happier
This commit is contained in:
Wez Furlong 2019-09-28 22:00:07 -07:00
parent 52a65370fa
commit 99579bfca2
2 changed files with 10 additions and 1 deletions

View File

@ -19,6 +19,7 @@ promise = { path = "../promise" }
resize = "0.3"
[features]
async_await = []
[target."cfg(windows)".dependencies]
winapi = { version = "0.3", features = [

View File

@ -1,4 +1,4 @@
#![feature(async_await)]
#![cfg_attr(feature="async_await", feature(async_await))]
use ::window::*;
use failure::Fallible;
@ -61,6 +61,7 @@ impl WindowCallbacks for MyWindow {
}
}
#[cfg(feature="async_await")]
async fn spawn_window() -> Result<(), Box<dyn std::error::Error>> {
let win = Window::new_window(
"myclass",
@ -89,6 +90,7 @@ async fn spawn_window() -> Result<(), Box<dyn std::error::Error>> {
Ok(())
}
#[cfg(feature="async_await")]
fn main() -> Fallible<()> {
let conn = Connection::init()?;
conn.spawn_task(async {
@ -97,3 +99,9 @@ fn main() -> Fallible<()> {
});
conn.run_message_loop()
}
#[cfg(not(feature="async_await"))]
fn main() {
eprintln!("Run me with rust 1.39 or later, or a current nightly build");
eprintln!(" cargo +nightly run --example async --features async_await");
}