@@ -116,16 +116,58 @@ pub struct Ipv6Addr {
116
116
inner : c:: in6_addr ,
117
117
}
118
118
119
- #[ allow( missing_docs) ]
119
+ /// Scope of an [IPv6 multicast address] as defined in [IETF RFC 7346 section 2].
120
+ ///
121
+ /// # Stability Guarantees
122
+ ///
123
+ /// Not all possible values for a multicast scope have been assigned.
124
+ /// Future RFCs may introduce new scopes, which will be added as variants to this enum;
125
+ /// because of this the enum is marked as `#[non_exhaustive]`.
126
+ ///
127
+ /// # Examples
128
+ /// ```
129
+ /// #![feature(ip)]
130
+ ///
131
+ /// use std::net::Ipv6Addr;
132
+ /// use std::net::Ipv6MulticastScope::*;
133
+ ///
134
+ /// // An IPv6 multicast address with global scope (`ff0e::`).
135
+ /// let address = Ipv6Addr::new(0xff0e, 0, 0, 0, 0, 0, 0, 0);
136
+ ///
137
+ /// // Will print "Global scope".
138
+ /// match address.multicast_scope() {
139
+ /// Some(InterfaceLocal) => println!("Interface-Local scope"),
140
+ /// Some(LinkLocal) => println!("Link-Local scope"),
141
+ /// Some(RealmLocal) => println!("Realm-Local scope"),
142
+ /// Some(AdminLocal) => println!("Admin-Local scope"),
143
+ /// Some(SiteLocal) => println!("Site-Local scope"),
144
+ /// Some(OrganizationLocal) => println!("Organization-Local scope"),
145
+ /// Some(Global) => println!("Global scope"),
146
+ /// Some(_) => println!("Unknown scope"),
147
+ /// None => println!("Not a multicast address!")
148
+ /// }
149
+ ///
150
+ /// ```
151
+ ///
152
+ /// [IPv6 multicast address]: Ipv6Addr
153
+ /// [IETF RFC 7346 section 2]: https://tools.ietf.org/html/rfc7346#section-2
120
154
#[ derive( Copy , PartialEq , Eq , Clone , Hash , Debug ) ]
121
155
#[ unstable( feature = "ip" , issue = "27709" ) ]
156
+ #[ non_exhaustive]
122
157
pub enum Ipv6MulticastScope {
158
+ /// Interface-Local scope.
123
159
InterfaceLocal ,
160
+ /// Link-Local scope.
124
161
LinkLocal ,
162
+ /// Realm-Local scope.
125
163
RealmLocal ,
164
+ /// Admin-Local scope.
126
165
AdminLocal ,
166
+ /// Site-Local scope.
127
167
SiteLocal ,
168
+ /// Organization-Local scope.
128
169
OrganizationLocal ,
170
+ /// Global scope.
129
171
Global ,
130
172
}
131
173
0 commit comments