//! Simple hello world example using asynchronous stdio. This also illustrates the auto-flush //! capability of the library, which matches the standard lib. extern crate futures_lite; extern crate async_blocking_stdio as astdio; use futures_lite::io::AsyncWriteExt; fn main() -> std::io::Result<()> { futures_lite::future::block_on(async { let mut stdout_handle = astdio::stdout().lock().await; // Note how we do not need to bother flushing this - it's auto-handled by the crate stdout_handle.write_all(b"Hello world!\n").await }) } // async-blocking-stdio - std::io::std{in(), out(), err()}, but async // Copyright (C) 2024 Matti Bryce // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see .