| Crates.io | abstract_socket |
| lib.rs | abstract_socket |
| version | 0.1.0 |
| created_at | 2026-01-21 19:00:36.912052+00 |
| updated_at | 2026-01-21 19:00:36.912052+00 |
| description | Types to abstract over TCP and Unix socket. |
| homepage | |
| repository | https://github.com/Kixunil/abstract_socket |
| max_upload_size | |
| id | 2059893 |
| size | 52,749 |
This crate is in development and wasn't widely tested yet. It may also lack some functionality. I'll be happy to accept contributions.
This crate helps you write applications that support both TCP and Unix sockets by providing
mostly-drop-in replacements for the respective types. If target_family is not unix the unix
socket support transparently disappears unless you're manually inspecting the socket address.
This ensures your application is multi-platform out of the box.
The crate currently only supports streams, not datagrams.
To add Unix support to an existing application supporting TCP, follow these steps:
TcpStream (or UnixStream) with StreamTcpListener (or UnixListener) with ListenerSocketAddr from std with SocketAddrasync-io - uses the async-io crate to provide an async-std-compatible wrapper. Note that this wasn't tested in practice because I mistakenly thought I need this but I dicovered I don't just before testing it, so I just kept it in.
The current MSRV is 1.70. The policy is to at least support the latest Debian stable release and not bump the version for cosmetic changes.
MITNFA