1#![cfg_attr(feature = "unsatable_preview", feature(unix_socket_ancillary_data))]
29
30
31#![cfg_attr(any(target_os="illumos", target_os="solaris", target_os="windows"), allow(unused))]
33
34#![allow(
35 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, )]
45
46#[cfg(feature="mio")]
47pub extern crate mio;
48
49#[cfg(feature="xio-rs")]
50pub extern crate xio_rs;
51
52#[cfg(target_family = "unix")]
53extern crate libc;
54
55#[cfg(target_family = "windows")]
56extern crate windows_sys;
57
58#[cfg(target_family = "windows")]
59extern crate tempfile;
60
61macro_rules! cvt {($syscall:expr) => {
63 match $syscall
64 {
65 -1 => Err(io::Error::last_os_error()),
66 ok => Ok(ok),
67 }
68}}
69
70macro_rules! cvt_r {($syscall:expr) => {
72 loop
73 {
74 let result = $syscall;
75 if result != -1
76 {
77 break Ok(result);
78 }
79
80 let err = io::Error::last_os_error();
81
82 if err.kind() != std::io::ErrorKind::Interrupted
83 {
84 break Err(err);
85 }
86 }
87}}
88
89#[cfg(target_family = "windows")]
90mod windows_unixstream;
91
92mod addr;
93
94#[cfg(feature = "unsatable_preview")]
95mod ancillary_rust;
96
97#[cfg(target_family = "unix")]
98mod credentials;
99
100#[cfg(target_family = "unix")]
101mod helpers;
102
103#[cfg(target_family = "unix")]
104mod ancillary;
105
106#[cfg(target_family = "unix")]
107mod traits;
108
109#[cfg(target_family = "unix")]
110mod seqpacket;
111
112
113pub(crate) const LISTEN_BACKLOG: std::ffi::c_int = 128;pub use addr::{UnixSocketAddr, UnixSocketAddrRef, AddrName};
117
118#[cfg(windows)]
119pub use windows_unixstream::{WindowsUnixListener, WindowsUnixStream, RecvFlags};
120
121#[cfg(windows)]
122pub use windows_unixstream::{get_socket_family, get_socket_type};
123
124#[cfg(target_family = "unix")]
125pub use ancillary::{AncillaryBuf, Ancillary, AncillaryItem};
126
127#[cfg(target_family = "unix")]
128pub use traits::{UnixListenerExt, UnixStreamExt, UnixDatagramExt};
129
130#[cfg(target_family = "unix")]
131pub use seqpacket::{UnixSeqpacketListener, UnixSeqpacketConn};
132
133#[cfg(target_family = "unix")]
134pub use credentials::ConnCredentials;
135
136#[cfg(target_family = "unix")]
137pub mod nonblocking {
138 pub use crate::seqpacket::NonblockingUnixSeqpacketListener as UnixSeqpacketListener;
139 pub use crate::seqpacket::NonblockingUnixSeqpacketConn as UnixSeqpacketConn;
140}
141
142#[cfg(debug_assertions)]
143mod doctest_md_files {
144 macro_rules! mdfile {($content:expr, $(#[$meta:meta])* $attach_to:ident) => {
145 #[doc=$content]
146 #[allow(unused)]
147 $(#[$meta])* enum $attach_to {}
149 }}
150 mdfile!{
151 include_str!("../README.md"),
152 #[cfg(any(target_os="linux", target_os="android"))] Readme
154 }
155}