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 //! Event-driven nonblocking net-io components.
15 
16 mod poll;
17 pub use poll::Poll;
18 
19 mod token;
20 pub use token::Token;
21 
22 pub mod sys;
23 #[cfg(feature = "udp")]
24 pub use sys::{ConnectedUdpSocket, UdpSocket};
25 pub use sys::{Event, EventTrait, Events, Selector};
26 #[cfg(unix)]
27 pub use sys::{SocketAddr, UnixDatagram, UnixListener, UnixStream};
28 #[cfg(feature = "tcp")]
29 pub use sys::{TcpListener, TcpStream};
30 
31 /// unix-specific
32 #[cfg(unix)]
33 pub mod unix {
34     pub use crate::sys::SourceFd;
35 }
36 
37 mod interest;
38 pub use interest::Interest;
39 
40 mod source;
41 pub use source::{Fd, Source};
42 
43 mod waker;
44 pub use waker::Waker;
45 
46 #[cfg(not(any(feature = "tcp", feature = "udp")))]
47 std::compile_error!("tcp and udp feature must be enabled one of them for this crate.");
48