#![cfg(unix)]
#![cfg_attr(any(target_os="illumos", target_os="solaris"), allow(unused))]
#![allow(
clippy::cast_lossless, // improves portability when values are limited by the OS anyway
clippy::unnecessary_cast, // not necessarily unnecessary on other OSes
clippy::len_zero, // the `!` in `if !foo.is_empty()` can be easy to miss
clippy::needless_return, // consistency with early returns, and to not look incomplete
clippy::redundant_closure, // avoiding auto-functions of tuple structs and enum variants
clippy::needless_lifetimes, // explicity when useful
clippy::needless_borrow, // dereferencing one field from a raw pointer
clippy::bool_to_int_with_if, // clearer than usize::from()
// more lints are disabled inside ancillary.rs and credentials.rs
)]
extern crate libc;
#[cfg(feature="mio_08")]
extern crate mio_08;
#[cfg(feature="tokio")]
extern crate tokio as tokio_crate;
macro_rules! cvt {($syscall:expr) => {
match $syscall {
-1 => Err(io::Error::last_os_error()),
ok => Ok(ok),
}
}}
macro_rules! cvt_r {($syscall:expr) => {
loop {
let result = $syscall;
if result != -1 {
break Ok(result);
}
let err = io::Error::last_os_error();
if err.kind() != ErrorKind::Interrupted {
break Err(err);
}
}
}}
mod addr;
mod credentials;
mod helpers;
mod ancillary;
mod traits;
mod seqpacket;
#[cfg(feature="tokio")]
pub mod tokio;
pub use addr::{UnixSocketAddr, UnixSocketAddrRef, AddrName};
pub use traits::{UnixListenerExt, UnixStreamExt, UnixDatagramExt};
pub use seqpacket::{UnixSeqpacketListener, UnixSeqpacketConn};
pub use credentials::ConnCredentials;
pub mod nonblocking {
pub use crate::seqpacket::NonblockingUnixSeqpacketListener as UnixSeqpacketListener;
pub use crate::seqpacket::NonblockingUnixSeqpacketConn as UnixSeqpacketConn;
}
#[cfg(debug_assertions)]
mod doctest_md_files {
macro_rules! mdfile {($content:expr, $(#[$meta:meta])* $attach_to:ident) => {
#[doc=$content]
#[allow(unused)]
$(#[$meta])* enum $attach_to {}
}}
mdfile!{
include_str!("../README.md"),
#[cfg(any(target_os="linux", target_os="android"))] Readme
}
}