about summary refs log tree commit diff
path: root/src/libstd/fs.rs
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-3612/+0
2020-06-30enable unsafe_op_in_unsafe_fn lintElton Law-0/+1
2020-06-30`#[deny(unsafe_op_in_unsafe_fn)]` in libstd/fs.rsElton Law-2/+4
2020-06-27Rollup merge of #73809 - robyoung:docs/add-links-to-DirEntry-metadata, ↵Manish Goregaokar-1/+4
r=hanna-kruppe Add links to fs::DirEntry::metadata `fs::DirEntry::metadata` doesn't traverse symlinks. It is not immediately clear what to do if you do want to traverse symlinks. This change adds links to the two other `metadata` functions that will follow symlinks.
2020-06-27Add links to fs::DirEntry::metadataRob Young-1/+4
`fs::DirEntry::metadata` doesn't traverse symlinks. It is not immediately clear what to do if you do want to traverse symlinks. This change adds links to the two other `metadata` functions that will follow symlinks.
2020-06-27Update the documentation to point to open instead of is_file and is_dirAlexis Bourget-10/+14
2020-06-11Added the note to Metadata tooAlexis Bourget-0/+6
2020-06-11Add documentation to point to `!is_dir` instead of `is_file`Alexis Bourget-0/+6
2020-04-26Update nameSteven Fackler-8/+8
2020-04-26Add Read/Write::can_read/write_vectoredSteven Fackler-0/+20
When working with an arbitrary reader or writer, code that uses vectored operations may end up being slower than code that copies into a single buffer when the underlying reader or writer doesn't actually support vectored operations. These new methods allow you to ask the reader or witer up front if vectored operations are efficiently supported. Currently, you have to use some heuristics to guess by e.g. checking if the read or write only accessed the first buffer. Hyper is one concrete example of a library that has to do this dynamically: https://github.com/hyperium/hyper/blob/0eaf304644a396895a4ce1f0146e596640bb666a/src/proto/h1/io.rs#L582-L594
2020-04-02Use Self over specific type in return positionLzu Tao-7/+7
2020-03-06Fix missing ` in doc for File::with_optionsLukas-1/+1
2020-02-19Reword OpenOptions::{create, create_new} doc.jumbatm-8/+4
2019-12-25tidy: change msdn links to newer locationsLzu Tao-1/+1
see accouncement at https://docs.microsoft.com/welcome-to-docs
2019-12-14Fix incorrect example code of OpenOptions::openPatrick Wang-1/+1
2019-12-03Modified the testcases for VxWorksUmesh Kalappa-2/+9
2019-11-29Format libstd with rustfmtDavid Tolnay-131/+204
This commit applies rustfmt with rust-lang/rust's default settings to files in src/libstd *that are not involved in any currently open PR* to minimize merge conflicts. THe list of files involved in open PRs was determined by querying GitHub's GraphQL API with this script: https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8 With the list of files from the script in outstanding_files, the relevant commands were: $ find src/libstd -name '*.rs' \ | xargs rustfmt --edition=2018 --unstable-features --skip-children $ rg libstd outstanding_files | xargs git checkout -- Repeating this process several months apart should get us coverage of most of the rest of libstd. To confirm no funny business: $ git checkout $THIS_COMMIT^ $ git show --pretty= --name-only $THIS_COMMIT \ | xargs rustfmt --edition=2018 --unstable-features --skip-children $ git diff $THIS_COMMIT # there should be no difference
2019-11-02Auto merge of #65429 - Timmmm:withoptions, r=Mark-Simulacrumbors-2/+35
Add File::with_options This provides a more fluent API to create files with options, and also avoids the need to import OpenOptions. This implements @aldanor's [suggestion](https://github.com/rust-lang/rfcs/pull/2615#issuecomment-448591304) which was popular.
2019-10-18Prefer statx on linux if availableoxalica-4/+18
2019-10-16Fix read/write links hopefully!Tim Hutt-2/+4
2019-10-15Add File::with_optionsTim Hutt-2/+33
This provides a more fluent API to create files with options, and also avoids the need to import OpenOptions.
2019-10-07use 'invalid argument' for vxWorksBaoshanPang-1/+3
2019-09-24Rollup merge of #63356 - ali-raheem:issue#63183, r=KodrAusMazdak Farrokhzad-0/+25
Issue#63183: Add fs::read_dir() and ReadDir warning about iterator order + example As per https://github.com/rust-lang/rust/issues/63183 Add warning about iterator order to read_dir and ReadDir, add example of explicitly ordering direntrys.
2019-09-15Rollup merge of #63872 - marmistrz:readdir, r=jonas-schievinkMazdak Farrokhzad-1/+2
Document platform-specific behavior of the iterator returned by std::fs::read_dir
2019-09-09Replace println statements with explanatory commentsAli Raheem-7/+4
2019-09-06Upgrade rand to 0.7Mateusz Mikuła-1/+1
2019-08-26Comment out println in read_dir sorting exampleAli Raheem-5/+5
2019-08-25Document platform-specific behavior of the iterator returned by ↵Marcin Mielniczuk-1/+2
std::fs::read_dir
2019-08-15Fix gramitcal error in read_dir exampleAli Raheem-1/+1
2019-08-08Remove Iteration order headingAli Raheem-4/+0
2019-08-07Add fs::read_dir() and ReadDir warning about iterator order + exampleAli Raheem-0/+32
2019-08-06Add an overflow check in truncate implementation for Unix.Marcin Mielniczuk-0/+2
2019-07-29std: Fix a failing `fs` test on WindowsAlex Crichton-2/+2
In testing 4-core machines on Azure the `realpath_works_tricky` test in the standard library is failing with "The directory name is invalid". In attempting to debug this test I was able to reproduce the failure locally on my machine, and after inspecing the test it I believe is exploiting Unix-specific behavior that seems to only sometimes work on Windows. Specifically the test basically executes: mkdir -p a/b mkdir -p a/d touch a/f ln -s a/b/c ../d/e ln -s a/d/e ../f and then asserts that `canonicalize("a/b/c")` and `canonicalize("a/d/e")` are equivalent to `a/f`. On Windows however the first symlink is a "directory symlink" and the second is a file symlink. In both cases, though, they're pointing to files. This means that for whatever reason locally and on the 4-core environment the call to `canonicalize` is failing. On Azure today it seems to be passing, and I'm not entirely sure why. I'm sort of presuming that there's some sort of internals going on here where there's some global Windows setting which makes symlinks behavior more unix-like and ignore the directory hint. In any case this should keep the test working and also fixes the test locally for me.
2019-05-29Update libstd doctests to use dynmemoryruins-1/+1
2019-05-04Fix intra-doc link resolution failure on re-exporting libstdTaiki Endo-0/+2
2019-05-02Make `std::fs::copy` attempt to create copy-on-write clones of files on MacOS.Edward Barnard-2/+2
2019-04-27Stabilized vectored IOSteven Fackler-5/+5
This renames `std::io::IoVec` to `std::io::IoSlice` and `std::io::IoVecMut` to `std::io::IoSliceMut`, and stabilizes `std::io::IoSlice`, `std::io::IoSliceMut`, `std::io::Read::read_vectored`, and `std::io::Write::write_vectored`. Closes #58452
2019-04-25ignore-tidy-filelength on all files with greater than 3000 linesvarkor-0/+2
2019-04-18Simplify the returning of a Result a bitJan Nils Ferner-2/+1
2019-04-10std: Add `{read,write}_vectored` for more typesAlex Crichton-1/+19
This commit implements the `{read,write}_vectored` methods on more types in the standard library, namely: * `std::fs::File` * `std::process::ChildStd{in,out,err}` * `std::io::Std{in,out,err}` * `std::io::Std{in,out,err}Lock` * `std::io::Std{in,out,err}Raw` Where supported the OS implementations hook up to native support, otherwise it falls back to the already-defaulted implementation.
2019-04-04Auto merge of #59695 - Centril:rollup-88qffc2, r=Centrilbors-2/+9
Rollup of 8 pull requests Successful merges: - #59470 (Document std::fs::File close behavior ignoring errors) - #59555 (update miri) - #59556 (update stdsimd) - #59596 (Forward formatter settings to bounds of `Range<T>` in `fmt::Debug` impl) - #59639 (Never return uninhabited values at all) - #59671 (Make some of lexer's API private) - #59685 (Add description for -Os and -Oz in rustc.1) - #59686 (Temporarily disable stack probing for gnux32.) Failed merges: r? @ghost
2019-04-04Rollup merge of #59470 - czipperz:document-fs-file-close, r=dtolnayMazdak Farrokhzad-2/+9
Document std::fs::File close behavior ignoring errors Resolves #52685
2019-04-03File: Add documentation about dropping to sync_allChris Gregory-1/+5
2019-04-03wasi: Fill out `std::fs` module for WASIAlex Crichton-0/+8
This commit fills out the `std::fs` module and implementation for WASI. Not all APIs are implemented, such as permissions-related ones and `canonicalize`, but all others APIs have been implemented and very lightly tested so far. We'll eventually want to run a more exhaustive test suite! For now the highlights of this commit are: * The `std::fs::File` type is now backed by `WasiFd`, a raw WASI file descriptor. * All APIs in `std::fs` (except permissions/canonicalize) have implementations for the WASI target. * A suite of unstable extension traits were added to `std::os::wasi::fs`. These traits expose the raw filesystem functionality of WASI, namely `*at` syscalls (opening a file relative to an already opened one, for example). Additionally metadata only available on wasi is exposed through these traits. Perhaps one of the most notable parts is the implementation of path-taking APIs. WASI actually has no fundamental API that just takes a path, but rather everything is relative to a previously opened file descriptor. To allow existing APIs to work (that only take a path) WASI has a few syscalls to learn about "pre opened" file descriptors by the runtime. We use these to build a map of existing directory names to file descriptors, and then when using a path we try to anchor it at an already-opened file. This support is very rudimentary though and is intended to be shared with C since it's likely to be so tricky. For now though the C library doesn't expose quite an API for us to use, so we implement it for now and will swap it out as soon as one is available.
2019-04-02Link to sync_allChris Gregory-1/+2
2019-04-01Document using `sync_all`Chris Gregory-4/+3
2019-03-31libstd: deny(elided_lifetimes_in_paths)Mazdak Farrokhzad-3/+3
2019-03-27Document std::fs::File close behavior ignoring errorsChris Gregory-1/+4
2019-03-25SGX target: fix std unit testsJethro Beekman-1/+1
2019-03-16Rollup merge of #59082 - alexreg:cosmetic-2-doc-comments, r=Centrilkennytm-1/+1
A few improvements to comments in user-facing crates Not too many this time, and all concern comments (almost all doc comments) in user-facing crates (libstd, libcore, liballoc). r? @steveklabnik