1#![cfg_attr(any(target_os="illumos", target_os="solaris", target_os="windows"), allow(unused))]
24
25#![allow(
26 clippy::cast_lossless, clippy::unnecessary_cast, clippy::len_zero, clippy::needless_return, clippy::redundant_closure, clippy::needless_lifetimes, clippy::needless_borrow, clippy::bool_to_int_with_if, )]
36
37#[cfg(feature="mio")]
38pub extern crate mio;
39
40#[cfg(feature="xio-rs")]
41pub extern crate xio_rs;
42
43#[cfg(target_family = "unix")]
44extern crate libc;
45
46#[cfg(target_family = "windows")]
47extern crate windows_sys;
48
49#[cfg(target_family = "windows")]
50extern crate tempfile;
51
52macro_rules! cvt {($syscall:expr) => {
54 match $syscall
55 {
56 -1 => Err(io::Error::last_os_error()),
57 ok => Ok(ok),
58 }
59}}
60
61macro_rules! cvt_r {($syscall:expr) => {
63 loop
64 {
65 let result = $syscall;
66 if result != -1
67 {
68 break Ok(result);
69 }
70
71 let err = io::Error::last_os_error();
72
73 if err.kind() != std::io::ErrorKind::Interrupted
74 {
75 break Err(err);
76 }
77 }
78}}
79
80#[cfg(target_family = "windows")]
81mod windows_unixstream;
82
83mod addr;
84
85#[cfg(target_family = "unix")]
86mod credentials;
87
88#[cfg(target_family = "unix")]
89mod helpers;
90
91#[cfg(target_family = "unix")]
92mod ancillary;
93
94#[cfg(target_family = "unix")]
95mod traits;
96
97#[cfg(target_family = "unix")]
98mod seqpacket;
99
100
101pub(crate) const LISTEN_BACKLOG: std::ffi::c_int = 128;pub use addr::{UnixSocketAddr, UnixSocketAddrRef, AddrName};
105
106#[cfg(windows)]
107pub use windows_unixstream::{WindowsUnixListener, WindowsUnixStream, RecvFlags};
108
109#[cfg(windows)]
110pub use windows_unixstream::{get_socket_family, get_socket_type};
111
112#[cfg(target_family = "unix")]
113pub use traits::{UnixListenerExt, UnixStreamExt, UnixDatagramExt};
114
115#[cfg(target_family = "unix")]
116pub use seqpacket::{UnixSeqpacketListener, UnixSeqpacketConn};
117
118#[cfg(target_family = "unix")]
119pub use credentials::ConnCredentials;
120
121#[cfg(target_family = "unix")]
122pub mod nonblocking {
123 pub use crate::seqpacket::NonblockingUnixSeqpacketListener as UnixSeqpacketListener;
124 pub use crate::seqpacket::NonblockingUnixSeqpacketConn as UnixSeqpacketConn;
125}
126
127#[cfg(debug_assertions)]
128mod doctest_md_files {
129 macro_rules! mdfile {($content:expr, $(#[$meta:meta])* $attach_to:ident) => {
130 #[doc=$content]
131 #[allow(unused)]
132 $(#[$meta])* enum $attach_to {}
134 }}
135 mdfile!{
136 include_str!("../README.md"),
137 #[cfg(any(target_os="linux", target_os="android"))] Readme
139 }
140}