diff options
Diffstat (limited to 'examples/basic.rs')
-rw-r--r-- | examples/basic.rs | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/examples/basic.rs b/examples/basic.rs index dce12cc..db56d20 100644 --- a/examples/basic.rs +++ b/examples/basic.rs @@ -1,10 +1,10 @@ use textmode::Textmode as _; #[cfg(feature = "async")] -async fn run( - tm: &mut textmode::Output, - input: &mut textmode::Input, -) -> textmode::Result<()> { +#[tokio::main] +async fn main() -> textmode::Result<()> { + let mut input = textmode::Input::new().await?; + let mut tm = textmode::Output::new().await?; tm.move_to(5, 5); tm.write_str("foo"); input.read_key().await?; @@ -23,16 +23,6 @@ async fn run( Ok(()) } -#[cfg(feature = "async")] -fn main() { - smol::block_on(async { - let mut input = textmode::Input::new().await.unwrap(); - let mut tm = textmode::Output::new().await.unwrap(); - let e = run(&mut tm, &mut input).await; - e.unwrap(); - }); -} - #[cfg(not(feature = "async"))] fn main() { let mut tm = textmode::blocking::Output::new().unwrap(); |