summary refs log tree commit diff
path: root/src/libstd/fs.rs
AgeCommit message (Collapse)AuthorLines
2018-04-01Auto merge of #49522 - mbrubeck:fs_read, r=SimonSapinbors-5/+5
Rename fs::read_string to read_to_string and stabilize As approved in https://github.com/rust-lang/rust/issues/46588#issuecomment-377530365 Closes #46588.
2018-03-30Rename fs::read_string to read_to_string and stabilizeMatt Brubeck-5/+5
2018-03-30fs_read_write_bytes stabilized in 1.26.0Matt Brubeck-2/+2
2018-03-30Auto merge of #49422 - mbrubeck:fs_read, r=TimNNbors-6/+2
Stabilize fs::read and fs::write As discussed in https://github.com/rust-lang/rust/issues/46588#issuecomment-373956283
2018-03-28Auto merge of #49357 - frewsxcv:frewsxcv-termination-doc-examples, ↵bors-263/+265
r=GuillaumeGomez Remove hidden `foo` functions from doc examples; use `Termination` trait. Fixes https://github.com/rust-lang/rust/issues/49233. Easier to review with the white-space ignoring `?w=1` feature: https://github.com/rust-lang/rust/pull/49357/files?w=1
2018-03-28Stabilize fs::read and fs::writeMatt Brubeck-6/+2
2018-03-28Remove hidden `foo` functions from doc examples; use `Termination` trait.Corey Farwell-263/+265
Fixes https://github.com/rust-lang/rust/issues/49233.
2018-03-16Fix Issue #48345, is_file, is_dir, and is_symlink note mutual exclusionMaxwell Powlison-3/+32
The methods on the structures `fs::FileType` and `fs::Metadata` of (respectively) `is_file`, `is_dir`, and `is_symlink` had some ambiguity in documentation, where it was not noted whether files will pass those tests exclusively or not. It is now written that the tests are mutually exclusive. Fixes #48345.
2018-02-23Clarify interfaction between File::set_len and file cursorjethrogb-0/+4
2018-02-17Wording fixes from review for File.Alexis Hunt-5/+5
2018-02-16Add a warning to File about mutability.Alexis Hunt-0/+15
Fixes #47708.
2018-02-05Rollup merge of #47999 - jaystrictor:master, r=Mark-Simulacrumkennytm-1/+1
Remove 'the this' in doc comments.
2018-02-04Remove 'the this' in doc comments.Jay Strict-1/+1
2018-02-03Clarify shared file handler behavior of File::try_clone.Corey Farwell-7/+29
Fixes https://github.com/rust-lang/rust/issues/46578.
2018-01-17Rollup merge of #47520 - mbrubeck:fstat, r=Mark-SimulacrumGuillaume Gomez-7/+9
Use File::metadata instead of fs::metadata to choose buffer size This replaces a `stat` syscall with `fstat` or similar, which can be faster. Fixes #47519.
2018-01-17Use File::metadata instead of fs::metadata to choose buffer sizeMatt Brubeck-7/+9
This replaces a `stat` syscall with `fstat` or similar, which can be faster. Fixes #47519.
2018-01-14Auto merge of #47268 - EdSchouten:cloudabi-libstd, r=alexcrichtonbors-1/+1
Implement libstd for CloudABI. Though CloudABI is strongly inspired by POSIX, its absence of features that don't work well with capability-based sandboxing makes it different enough that adding bits to `sys/unix` will make things a mess. This change therefore adds CloudABI specific platform code under `sys/cloudabi`. One of the goals of this implementation is to build as much as possible directly on top of CloudABI's system call layer, as opposed to using the C library. This is preferred, as the system call layer is supposed to be stable, whereas the C library ABI technically is not. An advantage of this approach is that it allows us to implement certain interfaces, such as mutexes and condition variables more optimally. They can be lighter than the ones provided by pthreads. This change disables some modules that cannot realistically be implemented right now. For example, libstd's pathname abstraction is not designed with POSIX `*at()` (e.g., `openat()`) in mind. The `*at()` functions are the only set of file system APIs available on CloudABI. There is no global file system namespace, nor a process working directory. Discussions on how to port these modules over are outside the scope of this change.
2018-01-11Make tests build on CloudABI.Ed Schouten-1/+1
There are some tests that need to be disabled on CloudABI specifically, due to the fact that the shims cannot be built in combination with unix::ext or windows::ext. Also improve the scoping of some imports to suppress compiler warnings.
2018-01-10Pre-allocate in fs::read and fs::read_stringMatt Brubeck-2/+10
2017-12-08fs::{read, read_string, write}: add tracking issue numberSimon Sapin-3/+3
2017-12-06Rename fs::read_utf8 to read_stringSimon Sapin-4/+4
2017-11-29Generalize fs::write from &[u8] to AsRef<[u8]>Simon Sapin-3/+3
2017-11-07Add `std::fs::read_utf8`, based on `File::open` and `read_to_string`Simon Sapin-1/+53
2017-11-07Move `File::{read,write}_contents` to `fs::{read,write}` free functions.Simon Sapin-70/+71
2017-11-07Add File::read_contents and File::write_contents convenience functions.Simon Sapin-0/+79
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)?) ```
2017-09-27Made `fs::copy` return the length of the main streamStephane Raux-3/+18
On Windows with the NTFS filesystem, `fs::copy` would return the sum of the lengths of all streams, which can be different from the length reported by `metadata` and thus confusing for users unaware of this NTFS peculiarity. This makes `fs::copy` return the same length `metadata` reports which is the value it used to return before PR #26751. Note that alternate streams are still copied; their length is just not included in the returned value. This change relies on the assumption that the stream with index 1 is always the main stream in the `CopyFileEx` callback. I could not find any official document confirming this but empirical testing has shown this to be true, regardless of whether the alternate stream is created before or after the main stream. Resolves #44532
2017-09-23Rollup merge of #44759 - durka:patch-43, r=steveklabnikCorey Farwell-3/+3
improve english in create_dir_all docs Just minor nitpicking.
2017-09-21improve english in create_dir_all docsAlex Burka-3/+3
2017-09-17Add test case for unix permissionsTrevor Merrifield-0/+21
2017-09-13Add note for append method in OpenOptions docsGuillaume Gomez-0/+6
2017-09-13Add missing urls for OpenOptions docsGuillaume Gomez-5/+17
2017-08-15Clarify 'writable'-changing behavior of `set_readonly`.Corey Farwell-1/+5
Fixes https://github.com/rust-lang/rust/issues/41984.
2017-08-15Clarify `readonly` method is also about being 'unwritable'.Corey Farwell-1/+1
2017-08-12Fix some typosBastien Orivel-1/+1
2017-08-10Add missing links in ReadDir docsGuillaume Gomez-5/+5
2017-08-10Add missing links on File struct docsGuillaume Gomez-2/+4
2017-07-18libstd: remove redundant & from &Path::new(...)NODA, Kai-3/+3
fn Path::new<S: AsRef ...>(s: &S) -> &Path Signed-off-by: NODA, Kai <nodakai@gmail.com>
2017-06-28Add links to the `ErrorKind` variants in errors of `open`Tobias Bucher-11/+16
2017-06-27Document possible `io::ErrorKind`s of `fs::open`Tobias Bucher-9/+25
Try to make clear that this isn't an API guarantee for now, as we likely want to refine these errors in the future, e.g. `ENOSPC` "No space left on device". CC #40322
2017-06-20Add `Read::initializer`.Steven Fackler-5/+9
This is an API that allows types to indicate that they can be passed buffers of uninitialized memory which can improve performance.
2017-05-26doc rewordingking6cong-1/+1
2017-05-08Remove need for &format!(...) or &&"" dances in `span_label` callsOliver Schneider-1/+1
2017-04-06Fix Markdown issues in the docsOliver Middleton-0/+14
* Since the switch to pulldown-cmark reference links need a blank line before the URLs. * Reference link references are not case sensitive. * Doc comments need to be indented uniformly otherwise rustdoc gets confused.
2017-04-02Improve documentation for `std::fs::DirBuilder`Peter Gerber-3/+6
2017-03-18Fix problems left in `concurrent_recursive_mkdir`Dawid Ciężarkiewicz-3/+4
Increase lifetime of `tmpdir`, and really change the length of test path.
2017-03-17Fix `create_dir_all("")`Dawid Ciężarkiewicz-0/+14
Add a test for `""` and `"."`.
2017-03-17Reorder match checks in `create_dir_all`Dawid Ciężarkiewicz-1/+1
Avoid doing `is_dir` in the fast path.
2017-03-17Fix problems found on Windows in `dir_create_all`Dawid Ciężarkiewicz-4/+3
Ignore the type of error altogether. The rationale is: it doesn't matter what was the problem if the directory is there. In the previous versions if the directory was there already we wouldn't even attempt to create it, so we wouldn't know about the problem neither. Make test path length smaller in `concurrent_recursive_mkdir` test.
2017-03-17Break line longer than 100 charactersDawid Ciężarkiewicz-1/+2
2017-03-17Add `concurrent_recursive_mkdir` testDawid Ciężarkiewicz-1/+22