1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
//! Network-related types for building type-safe network applications.
//!
//! This module provides strongly-typed abstractions for common network concepts,
//! ensuring type safety and preventing common errors in network programming.
//!
//! ## Design Rules
//!
//! All types in this module follow the core design rules, which adhere to
//! [Rust API Guidelines](https://rust-lang.github.io/api-guidelines/):
//!
//! ### 1. Type Safety (C-NEWTYPE, C-CUSTOM-TYPE)
//!
//! - Strong types prevent mixing incompatible values
//! - Arguments convey meaning through types, not `bool` or `Option`
//! - All validation performed at construction time
//! - No runtime errors from invalid states
//! - Invalid states are unrepresentable
//!
//! ### 2. Zero-Cost Abstractions
//!
//! - No runtime overhead compared to using primitive types
//! - All validation happens at compile time or construction
//! - Subsequent operations have zero cost
//! - Use `#[repr(transparent)]` for newtypes over primitive types
//!
//! ### 3. RFC Compliance
//!
//! - Domain names: RFC 1035
//! - Hostnames: RFC 1123
//! - IP addresses: Standard IPv4/IPv6
//!
//! ### 4. Composability (C-COMMON-TRAITS, C-CONV-TRAITS)
//!
//! All types implement standard traits:
//! - **Common traits** (C-COMMON-TRAITS):
//! - `Debug` for debugging
//! - `Clone` for copying
//! - `Display` for formatting
//! - `Hash` for use in hash maps
//! - `Eq` and `PartialEq` for equality
//! - `Ord` and `PartialOrd` for ordering (where applicable)
//! - `Default` for default values (where applicable)
//! - **Conversion traits** (C-CONV-TRAITS):
//! - `From` for infallible conversions
//! - `TryFrom` for fallible conversions
//! - `AsRef` for cheap borrowed conversions
//! - `AsMut` for cheap borrowed mutable conversions
//! - NOT `Into` or `TryInto` (these are blanket impls)
//!
//! ### 5. Security (C-SEND-SYNC, C-GOOD-ERR)
//!
//! - Types are `Send` and `Sync` where possible (C-SEND-SYNC)
//! - Error types implement `std::error::Error`, `Send`, `Sync` (C-GOOD-ERR)
//! - No unsafe code allowed
//! - Sensitive data uses `Zeroize` for automatic memory clearing
//!
//! ### 6. Explicit Over Implicit (C-DEREF, C-CTOR)
//!
//! - Only smart pointers implement `Deref` and `DerefMut` (C-DEREF)
//! - Constructors are static, inherent methods (C-CTOR)
//! - Prefer explicit constructors
//! - Clear, readable code over clever abstractions
//! - No declarative macros except for serde derives
//!
//! ## Types
//!
//! This module includes types for:
//!
//! - IP addresses (IPv4 and IPv6)
//! - Port numbers with validation
//! - Domain names with RFC 1035 validation
//! - Hostnames with RFC 1123 validation
//! - Host type that can represent IP addresses, domain names, or hostnames
//! - Socket addresses combining hosts and ports
//!
//! ## Features
//!
//! This module requires `net` feature to be enabled.
//!
//! ```toml
//! [dependencies]
//! bare-types = { version = "0.1", features = ["net"] }
//! ```
//!
//! ## `no_std` Support
//!
//! This module is fully `no_std` compatible. All types are built on `core::net`
//! (available in Rust 1.82+) and do not require the standard library.
//!
//! To use in a `no_std` environment:
//!
//! ```toml
//! [dependencies]
//! bare-types = { version = "0.1", default-features = false, features = ["net"] }
//! ```
//!
//! The `std` feature can be optionally enabled for `std::error::Error` implementations.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;