diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2016-09-14 17:15:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-14 17:15:37 +0200 |
| commit | e368cdd2d5fc2ceff4c4745600fda29dba9fd81f (patch) | |
| tree | 07ba4b94a005154353b10ccff0fd92b7424370d8 /src | |
| parent | a89690ec00ca98397183c3ef011f944448098f8b (diff) | |
| parent | fae439b92f68a67444814243d4951943a43b0273 (diff) | |
| download | rust-e368cdd2d5fc2ceff4c4745600fda29dba9fd81f.tar.gz rust-e368cdd2d5fc2ceff4c4745600fda29dba9fd81f.zip | |
Rollup merge of #36467 - frewsxcv:ipaddr, r=GuillaumeGomez
Add doc examples for std::net::IpAddr construction. None
Diffstat (limited to 'src')
| -rw-r--r-- | src/libstd/net/ip.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index c6a7a77e68a..05ef559422f 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -22,6 +22,24 @@ use sys::net::netc as c; use sys_common::{AsInner, FromInner}; /// An IP address, either an IPv4 or IPv6 address. +/// +/// # Examples +/// +/// Constructing an IPv4 address: +/// +/// ``` +/// use std::net::{IpAddr, Ipv4Addr}; +/// +/// IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)); +/// ``` +/// +/// Constructing an IPv6 address: +/// +/// ``` +/// use std::net::{IpAddr, Ipv6Addr}; +/// +/// IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)); +/// ``` #[stable(feature = "ip_addr", since = "1.7.0")] #[derive(Copy, Clone, Eq, PartialEq, Debug, Hash, PartialOrd, Ord)] pub enum IpAddr { |
