Add File::read_contents and File::write_contents convenience functions.

Before:

```rust
use std::fs::File;
use std::io::Read;

let mut bytes = Vec::new();
File::open(filename)?.read_to_end(&mut bytes)?;
do_something_with(bytes)
```

After:

```rust
use std::fs::File;

do_something_with(File::read_contents(filename)?)
```
This commit is contained in:
Simon Sapin
2017-11-07 16:17:03 +01:00
parent 3e7f501991
commit fd518ac4b0
2 changed files with 80 additions and 0 deletions

View File

@@ -269,6 +269,7 @@
#![feature(core_intrinsics)]
#![feature(dropck_eyepatch)]
#![feature(exact_size_is_empty)]
#![feature(file_read_write_contents)]
#![feature(fixed_size_array)]
#![feature(float_from_str_radix)]
#![feature(fn_traits)]