rust/src/libstd
Alex Crichton 256b8879cc Rollup merge of #44395 - jcdyer:ip-constructors, r=alexcrichton
Ipv4Addr and Ipv6Addr convenience constructors.

Introduce convenience constructors for common types.

This introduces the following constructors:

* Ipv6Addr::localhost()
* Ipv6Addr::unspecified()
* Ipv4Addr::localhost()
* Ipv4Addr::unspecified()

The recently added `From` implementations were nice for avoiding the fallibility of conversions from strings like `"127.0.0.1".parse().unwrap()`, and `"::1".parse().unwrap()`, but while the Ipv4 version is roughly comparable in verbosity, the Ipv6 version lacks zero-segment elision, which makes it significantly more awkward: `[0, 0, 0, 0, 0, 0, 0, 0].into()`.  While there isn't a clear way to introduce zero elision to type that can infallibly be converted into Ipv6 addresses, this PR resolves the problem for the two most commonly used addresses, which, incidentally, are the ones that suffer the most from the lack of zero-segment elision.

This change is dead simple, and introduces no backwards incompatibility.

See also, [this topic on the inernals board](https://internals.rust-lang.org/t/pre-rfc-convenience-ip-address-constructors/5878)
2017-09-16 17:09:37 -07:00
..
collections Avoid weird or_insert_with example 2017-09-05 13:37:36 -04:00
ffi Use rvalue promotion to 'static instead of static items. 2017-09-10 11:20:27 +03:00
io Fix tests 2017-09-01 20:07:04 +12:00
net Rollup merge of #44395 - jcdyer:ip-constructors, r=alexcrichton 2017-09-16 17:09:37 -07:00
os Add modifications needed for L4re in libstd 2017-09-08 14:36:56 +02:00
prelude Move unused-extern-crate to late pass 2017-08-27 19:02:24 +09:00
rand Introduce tidy lint to check for inconsistent tracking issues 2017-06-16 20:40:40 +02:00
sync change #![feature(const_fn)] to specific gates 2017-09-16 15:53:02 +00:00
sys Merge branch 'master' into threadname 2017-09-14 14:19:53 +01:00
sys_common Auto merge of #43972 - TobiasSchaffner:std_clean, r=alexcrichton 2017-09-14 03:02:58 +00:00
thread Auto merge of #43972 - TobiasSchaffner:std_clean, r=alexcrichton 2017-09-14 03:02:58 +00:00
time Disable the 80-year-difference test on 32-bit-time_t platforms. 2017-09-07 17:14:27 +08:00
ascii.rs Reduce str transmutes, add mut versions of methods. 2017-04-09 19:13:54 -04:00
build.rs Auto merge of #44251 - kennytm:osx-backtrace, r=alexcrichton 2017-09-09 17:32:13 +00:00
Cargo.toml Switch to rust-lang-nursery/compiler-builtins 2017-07-05 07:08:36 -07:00
env.rs Move global vars changing tests into run-pass 2017-06-24 18:23:39 +03:00
error.rs Fixed errors in libstd. 2017-08-02 15:16:20 +01:00
f32.rs Revert "Add clamp functions" 2017-09-08 16:07:21 -06:00
f64.rs Revert "Add clamp functions" 2017-09-08 16:07:21 -06:00
fs.rs Add note for append method in OpenOptions docs 2017-09-13 14:47:50 +02:00
heap.rs Bump master to 1.21.0 2017-07-25 07:03:19 -07:00
lib.rs change #![feature(const_fn)] to specific gates 2017-09-16 15:53:02 +00:00
macros.rs Use rvalue promotion to 'static instead of static items. 2017-09-10 11:20:27 +03:00
memchr.rs Fix inconsistent doc headings 2017-08-24 18:42:53 +02:00
num.rs Auto merge of #40706 - irfanhudda:doc-next-power-of-two, r=alexcrichton 2017-06-08 01:07:08 +00:00
panic.rs Fix some typos 2017-08-12 14:01:11 +02:00
panicking.rs Update bootstrap compiler 2017-08-31 06:58:58 -07:00
path.rs Rollup merge of #43983 - ids1024:redox-path-prefix, r=alexcrichton 2017-08-23 08:44:25 -04:00
primitive_docs.rs Mention null_mut on the pointer primitive docs. 2017-08-22 12:00:05 -05:00
process.rs use field init shorthand EVERYWHERE 2017-08-15 15:29:17 -07:00
rt.rs Update bootstrap compiler 2017-08-31 06:58:58 -07:00