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