url_fork/net/
mod.rs

1// Effectively all the code in this repo is copied with permission from Rust's std library.
2// They hold the copyright (http://rust-lang.org/COPYRIGHT) and whatever other rights, but this
3// crate is MIT licensed also, so it's all good.
4
5//! Networking primitives for TCP/UDP communication.
6//!
7//! This module provides networking functionality for the Transmission Control and User
8//! Datagram Protocols, as well as types for IP and socket addresses.  It has been ported
9//! from std::net to remove the dependency on std.
10//!
11//! This crate is a WIP, issues, feedback and PRs are welcome as long as they follow the theme of
12//! "std::net" clone.
13//!
14//! # Organization
15//!
16//! * [`IpAddr`] represents IP addresses of either IPv4 or IPv6; [`Ipv4Addr`] and
17//!   [`Ipv6Addr`] are respectively IPv4 and IPv6 addresses
18//! * [`TcpListener`] and [`TcpStream`] provide functionality for communication over TCP
19//! * [`UdpSocket`] provides functionality for communication over UDP
20//! * [`SocketAddr`] represents socket addresses of either IPv4 or IPv6; [`SocketAddrV4`]
21//!   and [`SocketAddrV6`] are respectively IPv4 and IPv6 socket addresses
22//! * [`ToSocketAddrs`] is a trait that used for generic address resolution when interacting
23//!   with networking objects like [`TcpListener`], [`TcpStream`] or [`UdpSocket`]
24//! * Other types are return or parameter types for various methods in this module
25
26#![allow(dead_code)]
27#![allow(unused_imports)]
28
29#[cfg(all(not(feature = "std"), feature = "serde"))]
30extern crate serde;
31
32#[cfg(feature = "std")]
33pub use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
34
35#[cfg(not(feature = "std"))]
36mod addr;
37#[cfg(all(not(feature = "std"), feature = "serde"))]
38mod de;
39#[cfg(not(feature = "std"))]
40mod helper;
41#[cfg(not(feature = "std"))]
42mod ip;
43#[cfg(not(feature = "std"))]
44mod parser;
45#[cfg(all(not(feature = "std"), feature = "serde"))]
46mod ser;
47#[cfg(all(not(feature = "std"), test))]
48mod test;
49
50#[cfg(not(feature = "std"))]
51pub use self::addr::{SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs};
52#[cfg(not(feature = "std"))]
53pub use self::ip::{IpAddr, Ipv4Addr, Ipv6Addr};