mirror of
https://github.com/wez/wezterm.git
synced 2024-11-23 15:04:36 +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:
parent
52a65370fa
commit
99579bfca2
@ -19,6 +19,7 @@ promise = { path = "../promise" }
|
||||
resize = "0.3"
|
||||
|
||||
[features]
|
||||
async_await = []
|
||||
|
||||
[target."cfg(windows)".dependencies]
|
||||
winapi = { version = "0.3", features = [
|
||||
|
@ -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");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user