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 //! Implementation of asynchronous IO under different platforms. 15 //! Linux: epoll 16 //! Windows: IOCP 17 18 macro_rules! cfg_tcp { 19 ($($item:item)*) => { 20 $( 21 #[cfg(feature = "tcp")] 22 $item 23 )* 24 } 25 } 26 27 macro_rules! cfg_udp { 28 ($($item:item)*) => { 29 $( 30 #[cfg(feature = "udp")] 31 $item 32 )* 33 } 34 } 35 36 #[cfg(windows)] 37 macro_rules! cfg_net { 38 ($($item:item)*) => { 39 $( 40 #[cfg(any(feature = "tcp", feature = "udp"))] 41 $item 42 )* 43 } 44 } 45 46 mod events; 47 pub use events::EventTrait; 48 49 #[cfg(unix)] 50 mod unix; 51 52 #[cfg(unix)] 53 pub use self::unix::*; 54 55 #[cfg(windows)] 56 mod windows; 57 58 #[cfg(windows)] 59 pub use self::windows::*; 60