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