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