about summary refs log tree commit diff
path: root/src/libstd/os.rs
AgeCommit message (Collapse)AuthorLines
2014-07-13libstd: Add a few doc examplesAnton Lofgren-7/+45
This patch adds doc examples for the make_absolute, change_dir, errors_string and args functions in the os module.
2014-07-11std: Move MemoryMap fields to methodsAlex Crichton-6/+12
If modified, you can safely unmap arbitrary memory. These fields are not intended to be modified, so read-only accessors are the only ones that are provided. Closes #15478
2014-07-08std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.Richo Healey-3/+3
[breaking-change]
2014-07-03Test fixes from the rollupAlex Crichton-1/+1
2014-07-03Fix spelling errors.Joseph Crail-1/+1
2014-07-03Add os::join_paths, make setenv non-utf8 capableAaron Turon-60/+147
This commit changes `os` in three ways: * It adds a `join_paths` function that is the converse to `split_paths`, easing manipulation of the `PATH` environment variable according to platform conventions. * **Breaking change**: It changes `split_paths` to no longer drop empty paths, since they are meaningful to some shells (where they are synonymous with the current working directory). * It changes `setenv` to take a `BytesContainer` rather than a `&str` value, since environment variables may have non-utf8 values on some platforms. Since `&str` is a `BytesContainer`, this is *not* a breaking change. Along the way, it also refactors the `split_paths` function so that `cfg` switches are applied internally (and the function header is given only once). This fixes a bug: the doc comment had an example for only one platform. [breaking-change]
2014-06-30libstd: set baseline stability levels.Aaron Turon-0/+2
Earlier commits have established a baseline of `experimental` stability for all crates under the facade (so their contents are considered experimental within libstd). Since `experimental` is `allow` by default, we should use the same baseline stability for libstd itself. This commit adds `experimental` tags to all of the modules defined in `std`, and `unstable` to `std` itself.
2014-06-30auto merge of #14613 : schmee/rust/utf16-iterator, r=huonwbors-5/+9
Closes #14358. ~~The tests are not yet moved to `utf16_iter`, so this probably won't compile. I'm submitting this PR anyway so it can be reviewed and since it was mentioned in #14611.~~ EDIT: Tests now use `utf16_iter`. This deprecates `.to_utf16`. `x.to_utf16()` should be replaced by either `x.utf16_iter().collect::<Vec<u16>>()` (the type annotation may be optional), or just `x.utf16_iter()` directly, if it can be used in an iterator context. [breaking-change] cc @huonw
2014-06-30Add `utf16_units`John Schmidt-5/+9
This deprecates `.to_utf16`. `x.to_utf16()` should be replaced by either `x.utf16_units().collect::<Vec<u16>>()` (the type annotation may be optional), or just `x.utf16_units()` directly, if it can be used in an iterator context. Closes #14358 [breaking-change]
2014-06-29librustc: Remove the fallback to `int` for integers and `f64` forPatrick Walton-1/+1
floating point numbers for real. This will break code that looks like: let mut x = 0; while ... { x += 1; } println!("{}", x); Change that code to: let mut x = 0i; while ... { x += 1; } println!("{}", x); Closes #15201. [breaking-change]
2014-06-28Rename all raw pointers as necessaryAlex Crichton-35/+39
2014-06-24auto merge of #14963 : w3ln4/rust/master, r=alexcrichtonbors-0/+4
The aim of these changes is not working out a generic bi-endianness architectures support but to allow people develop for little endian MIPS machines (issue #7190).
2014-06-24Added Mipsel architecture supportPawel Olzacki-0/+4
2014-06-18fix signatures of mmap-related functions from libcDaniel Micay-6/+5
2014-06-16Move `num_cpus` from `std::rt::util` to `std::os`. Closes #14707Jorge Aparicio-0/+15
2014-06-16std: Improve pipe() functionalityAlex Crichton-23/+34
* os::pipe() now returns IoResult<os::Pipe> * os::pipe() is now unsafe because it does not arrange for deallocation of file descriptors * os::Pipe fields are renamed from input to reader and out to write. * PipeStream::pair() has been added. This is a safe method to get a pair of pipes. * Dealing with pipes in native process bindings have been improved to be more robust in the face of failure and intermittent errors. This converts a few fail!() situations to Err situations. Closes #9458 cc #13538 Closes #14724 [breaking-change]
2014-06-12Basic iOS supportValerii Hiora-0/+81
2014-06-11auto merge of #14713 : darnuria/rust/Improve_std_os_documentation_#2, ↵bors-76/+140
r=alexcrichton Improving documentation, consistency, removes evils empty lines etc...
2014-06-12Improve docs and refactore std::os.Axel Viala-76/+140
2014-06-11rustc: Remove ~[T] from the languageAlex Crichton-2/+2
The following features have been removed * box [a, b, c] * ~[a, b, c] * box [a, ..N] * ~[a, ..N] * ~[T] (as a type) * deprecated_owned_vector lint All users of ~[T] should move to using Vec<T> instead.
2014-06-09std: Remove the as_utf16_p functionsAlex Crichton-31/+15
These functions are all much better expressed via RAII using the to_utf16() method on strings. This refactoring also takes this opportunity to properly handle when filenames aren't valid unicode when passed through to the windows I/O layer by properly returning I/O errors. All previous users of the `as_utf16_p` or `as_utf16_mut_p` functions will need to convert their code to using `foo.to_utf16().append_one(0)` to get a null-terminated utf16 string. [breaking-change]
2014-06-08core: Rename `container` mod to `collections`. Closes #12543Brian Anderson-1/+1
Also renames the `Container` trait to `Collection`. [breaking-change]
2014-06-08Fix spelling errors in comments.Joseph Crail-1/+1
2014-06-06std: Deal with fallout of rtio changesAlex Crichton-1/+1
2014-06-06Removing unused wrapper to libc::close.Axel Viala-6/+0
2014-06-05auto merge of #14641 : darnuria/rust/add_documentation_to_std_os, r=alexcrichtonbors-4/+57
Just opening a pull request for adding code examples and documentation to std::os. More to come soon.
2014-06-05Improve documentation on std::os::env.Axel Viala-2/+11
2014-06-05Adding examples and possible failures for getcwd.Axel Viala-2/+36
For both window and unix platforms.
2014-06-04Add code example to std::os::getenv for unix.Axel Viala-0/+10
2014-06-03std: Remove generics from Option::expectAlex Crichton-3/+1
This commit removes the <M: Any + Send> type parameter from Option::expect in favor of just taking a hard-coded `&str` argument. This allows this function to move into libcore. Previous code using strings with `expect` will continue to work, but code using this implicitly to transmit task failure will need to unwrap manually with a `match` statement. [breaking-change] Closes #14008
2014-05-30Add os::split_pathsAaron Turon-2/+94
Adds a platform-specific function, `split_paths` to the `os` module. This function can be used to parse PATH-like environment variables according to local platform conventions. Closes #14352.
2014-05-30windows: Allow snake_case errors for now.Kevin Butler-1/+2
2014-05-29std: Recreate a `rand` moduleAlex Crichton-1/+2
This commit shuffles around some of the `rand` code, along with some reorganization. The new state of the world is as follows: * The librand crate now only depends on libcore. This interface is experimental. * The standard library has a new module, `std::rand`. This interface will eventually become stable. Unfortunately, this entailed more of a breaking change than just shuffling some names around. The following breaking changes were made to the rand library: * Rng::gen_vec() was removed. This has been replaced with Rng::gen_iter() which will return an infinite stream of random values. Previous behavior can be regained with `rng.gen_iter().take(n).collect()` * Rng::gen_ascii_str() was removed. This has been replaced with Rng::gen_ascii_chars() which will return an infinite stream of random ascii characters. Similarly to gen_iter(), previous behavior can be emulated with `rng.gen_ascii_chars().take(n).collect()` * {IsaacRng, Isaac64Rng, XorShiftRng}::new() have all been removed. These all relied on being able to use an OSRng for seeding, but this is no longer available in librand (where these types are defined). To retain the same functionality, these types now implement the `Rand` trait so they can be generated with a random seed from another random number generator. This allows the stdlib to use an OSRng to create seeded instances of these RNGs. * Rand implementations for `Box<T>` and `@T` were removed. These seemed to be pretty rare in the codebase, and it allows for librand to not depend on liballoc. Additionally, other pointer types like Rc<T> and Arc<T> were not supported. If this is undesirable, librand can depend on liballoc and regain these implementations. * The WeightedChoice structure is no longer built with a `Vec<Weighted<T>>`, but rather a `&mut [Weighted<T>]`. This means that the WeightedChoice structure now has a lifetime associated with it. * The `sample` method on `Rng` has been moved to a top-level function in the `rand` module due to its dependence on `Vec`. cc #13851 [breaking-change]
2014-05-28std: Remove format_strbuf!()Alex Crichton-2/+2
This was only ever a transitionary macro.
2014-05-27std: Rename strbuf operations to stringRicho Healey-13/+13
[breaking-change]
2014-05-25De-realstd os::argsKevin Ballard-14/+1
With the test runner using ::std::os::args(), and std::std::os now being a re-export of realstd::os, there's no more need for realstd stuff mucking up rt::args. Remove the one test of os::args(), as it's not very useful and it won't work anymore now that rt::args doesn't use realstd.
2014-05-25libstd: Remove unnecessary re-exports under std::stdKevin Ballard-5/+5
2014-05-24core: rename strbuf::StrBuf to string::StringRicho Healey-16/+16
[breaking-change]
2014-05-23core: Finish stabilizing the `mem` module.Alex Crichton-2/+2
* All of the *_val functions have gone from #[unstable] to #[stable] * The overwrite and zeroed functions have gone from #[unstable] to #[stable] * The uninit function is now deprecated, replaced by its stable counterpart, uninitialized [breaking-change]
2014-05-22libcore: Remove all uses of `~str` from `libcore`.Patrick Walton-26/+35
[breaking-change]
2014-05-22libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.Patrick Walton-53/+65
2014-05-15Updates with core::fmt changesAlex Crichton-5/+5
1. Wherever the `buf` field of a `Formatter` was used, the `Formatter` is used instead. 2. The usage of `write_fmt` is minimized as much as possible, the `write!` macro is preferred wherever possible. 3. Usage of `fmt::write` is minimized, favoring the `write!` macro instead.
2014-05-14librand: Remove all uses of `~str` from `librand`Patrick Walton-3/+3
2014-05-13Use Get/FreeEnvironmentStringsW instead of Get/FreeEnvironmentStringsAPhil Ruffwind-9/+31
Changed libstd to use Get/FreeEnvironmentStringsW instead of Get/FreeEnvironmentStringsA to support Unicode environment variables.
2014-05-13Use CreateProcessW instead of CreateProcessAPhil Ruffwind-1/+5
Changed libnative to use CreateProcessW instead of CreateProcessA. In addition, the lpEnvironment parameter now uses Unicode. Added a helper function os::win32::as_mut_utf16_p, which does basically the same thing as os::win32::as_utf16_p except the pointer is mutable.
2014-05-12Test fixes from rollupAlex Crichton-2/+1
Closes #14163 (Fix typos in rustc manpage) Closes #14161 (Add the patch number to version strings. Closes #13289) Closes #14156 (rustdoc: Fix hiding implementations of traits) Closes #14152 (add shebang to scripts that have execute bit set) Closes #14150 (libcore: remove fails from slice.rs and remove duplicated length checking) Closes #14147 (Make ProcessOutput Eq, TotalEq, Clone) Closes #14142 (doc: updates rust manual (loop to continue)) Closes #14141 (doc: Update the linkage documentation) Closes #14139 (Remove an unnecessary .move_iter().collect()) Closes #14136 (Two minor fixes in parser.rs) Closes #14130 (Fixed typo in comments of driver.rs) Closes #14128 (Add `stat` method to `std::io::fs::File` to stat without a Path.) Closes #14114 (rustdoc: List macros in the sidebar) Closes #14113 (shootout-nbody improvement) Closes #14112 (Improved example code in Option) Closes #14104 (Remove reference to MutexArc) Closes #14087 (emacs: highlight `macro_name!` in macro invocations using [] delimiters)
2014-05-12Remove an unnecessary .move_iter().collect()Simon Sapin-1/+1
2014-05-09auto merge of #14054 : luqmana/rust/at, r=alexcrichtonbors-7/+9
`/data/local/tmp` seems to be more common.
2014-05-08libstd: Check TMPDIR for android as well and if not set use ↵Luqman Aden-7/+9
'/data/local/tmp' instead of '/data/tmp'.
2014-05-08Handle fallout in osKevin Ballard-24/+24
os::env(), os::args(), and related functions now use Vec<T> instead of ~[T].