1 // Copyright (c) 2023 Huawei Device Co., Ltd. 2 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // you may not use this file except in compliance with the License. 4 // You may obtain a copy of the License at 5 // 6 // http://www.apache.org/licenses/LICENSE-2.0 7 // 8 // Unless required by applicable law or agreed to in writing, software 9 // distributed under the License is distributed on an "AS IS" BASIS, 10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 14 //! Usability Traits and helpers for asynchronous I/O functionality. 15 //! 16 //! This module is an asynchronous version of [`std::io`] 17 18 mod async_buf_read; 19 mod async_read; 20 mod async_seek; 21 mod async_write; 22 mod buffered; 23 mod read_buf; 24 mod read_task; 25 mod seek_task; 26 mod stderr; 27 mod stdin; 28 mod stdio; 29 mod stdout; 30 mod write_task; 31 32 pub use async_buf_read::{AsyncBufRead, AsyncBufReadExt}; 33 pub use async_read::{AsyncRead, AsyncReadExt}; 34 pub use async_seek::{AsyncSeek, AsyncSeekExt}; 35 pub use async_write::{AsyncWrite, AsyncWriteExt}; 36 pub use buffered::{AsyncBufReader, AsyncBufWriter}; 37 pub use read_buf::ReadBuf; 38 pub use read_task::ReadTask; 39 pub use stderr::{stderr, Stderr}; 40 pub use stdin::{stdin, Stdin}; 41 pub(crate) use stdio::State; 42 pub use stdout::{stdout, Stdout}; 43 44 macro_rules! poll_ready { 45 ($e:expr) => { 46 match $e { 47 std::task::Poll::Ready(t) => t, 48 std::task::Poll::Pending => return Poll::Pending, 49 } 50 }; 51 } 52 53 pub(crate) use poll_ready; 54