about summary refs log tree commit diff
path: root/src/libextra
AgeCommit message (Collapse)AuthorLines
2013-11-04Move io::file to io::fs and fns out of FileAlex Crichton-9/+9
This renames the `file` module to `fs` because that more accurately describes its current purpose (manipulating the filesystem, not just files). Additionally, this adds an UnstableFileStat structure as a nested structure of FileStat to signify that the fields should not be depended on. The structure is currently flagged with #[unstable], but it's unlikely that it has much meaning. Closes #10241
2013-11-03Fill out the remaining functionality in io::fileAlex Crichton-13/+12
This adds bindings to the remaining functions provided by libuv, all of which are useful operations on files which need to get exposed somehow. Some highlights: * Dropped `FileReader` and `FileWriter` and `FileStream` for one `File` type * Moved all file-related methods to be static methods under `File` * All directory related methods are still top-level functions * Created `io::FilePermission` types (backed by u32) that are what you'd expect * Created `io::FileType` and refactored `FileStat` to use FileType and FilePermission * Removed the expanding matrix of `FileMode` operations. The mode of reading a file will not have the O_CREAT flag, but a write mode will always have the O_CREAT flag. Closes #10130 Closes #10131 Closes #10121
2013-11-03Remove all blocking std::os blocking functionsAlex Crichton-42/+45
This commit moves all thread-blocking I/O functions from the std::os module. Their replacements can be found in either std::rt::io::file or in a hidden "old_os" module inside of native::file. I didn't want to outright delete these functions because they have a lot of special casing learned over time for each OS/platform, and I imagine that these will someday get integrated into a blocking implementation of IoFactory. For now, they're moved to a private module to prevent bitrot and still have tests to ensure that they work. I've also expanded the extensions to a few more methods defined on Path, most of which were previously defined in std::os but now have non-thread-blocking implementations as part of using the current IoFactory. The api of io::file is in flux, but I plan on changing it in the next commit as well. Closes #10057
2013-11-03Rename files to match current recommendations.Chris Morgan-1/+0
New standards have arisen in recent months, mostly for the use of rustpkg, but the main Rust codebase has not been altered to match these new specifications. This changeset rectifies most of these issues. - Renamed the crate source files `src/libX/X.rs` to `lib.rs`, for consistency with current styles; this affects extra, rustc, rustdoc, rustpkg, rustuv, std, syntax. - Renamed `X/X.rs` to `X/mod.rs,` as is now recommended style, for `std::num` and `std::terminfo`. - Shifted `src/libstd/str/ascii.rs` out of the otherwise unused `str` directory, to be consistent with its import path of `std::ascii`; libstd is flat at present so it's more appropriate thus. While this removes some `#[path = "..."]` directives, it does not remove all of them, and leaves certain other inconsistencies, such as `std::u8` et al. which are actually stored in `src/libstd/num/` (one subdirectory down). No quorum has been reached on this issue, so I felt it best to leave them all alone at present. #9208 deals with the possibility of making libstd more hierarchical (such as changing the crate to match the current filesystem structure, which would make the module path `std::num::u8`). There is one thing remaining in which this repository is not rustpkg-compliant: rustpkg would have `src/std/` et al. rather than `src/libstd/` et al. I have not endeavoured to change that at this point as it would guarantee prompt bitrot and confusion. A change of that magnitude needs to be discussed first.
2013-11-01Register new snapshotsAlex Crichton-3/+0
Closes #2240
2013-11-01Give test and main tasks better namesAlex Crichton-0/+4
Tests now have the same name as the test that they're running (to allow for easier diagnosing of failure sources), and the main task is now specially named <main> instead of <unnamed>. Closes #10195 Closes #10073
2013-10-31auto merge of #10189 : alexcrichton/rust/inner-statics, r=cmrbors-19/+28
Closes #9186
2013-10-30Forbid type parameters in inner staticsAlex Crichton-19/+28
Closes #9186
2013-10-30auto merge of #10120 : Kimundi/rust/remove_sys, r=alexcrichtonbors-0/+2
- `begin_unwind` and `fail!` is now generic over any `T: Any + Send`. - Every value you fail with gets boxed as an `~Any`. - Because of implementation issues, `&'static str` and `~str` are still handled specially behind the scenes. - Changed the big macro source string in libsyntax to a raw string literal, and enabled doc comments there.
2013-10-30Prepared `std::sys` for removal, and made `begin_unwind` simplerMarvin Löbel-0/+2
- `begin_unwind` is now generic over any `T: Any + Send`. - Every value you fail with gets boxed as an `~Any`. - Because of implementation details, `&'static str` and `~str` are still handled specially behind the scenes. - Changed the big macro source string in libsyntax to a raw string literal, and enabled doc comments there.
2013-10-29Assorted cleanups suggested by reviewers.Jed Davis-1/+2
2013-10-29Add repr attributes in various places that need them.Jed Davis-1/+1
2013-10-28Register new snapshotsAlex Crichton-4/+3
2013-10-28Remove the extension traits for Readers/WritersAlex Crichton-13/+12
These methods are all excellent candidates for default methods, so there's no need to require extra imports of various traits.
2013-10-28Allow fail messages to be caught, and introduce the Any traitMarvin Löbel-6/+5
Some code cleanup, sorting of import blocks Removed std::unstable::UnsafeArc's use of Either Added run-fail tests for the new FailWithCause impls Changed future_result and try to return Result<(), ~Any>. - Internally, there is an enum of possible fail messages passend around. - In case of linked failure or a string message, the ~Any gets lazyly allocated in future_results recv method. - For that, future result now returns a wrapper around a Port. - Moved and renamed task::TaskResult into rt::task::UnwindResult and made it an internal enum. - Introduced a replacement typedef `type TaskResult = Result<(), ~Any>`.
2013-10-27auto merge of #10050 : gifnksm/rust/ratio-methods, r=pcwaltonbors-0/+66
After merging 0ada7c7, user code have not been able to access to `Ratio`'s numerator and denominator fields. In some algorithms, it is needed to get an rational number's numerator or denominator, but keeping these fields private is necessary for guaranteeing that `Ratio` numbers are irreducible. So, I added the getter methods `numer()` and `denom()`. As a bonus, this commit adds utility methods relating to the ratio-integer conversion.
2013-10-27Remove MD4.Palmer Cox-151/+0
2013-10-27Remove MD5 and Sha2. Move Sha1 and support code into librustpkg.Palmer Cox-2213/+0
2013-10-27Update workcache to no longer use Sha1.Palmer Cox-17/+5
2013-10-25auto merge of #10054 : alexcrichton/rust/basic-event-loop, r=brsonbors-2/+2
This is more progress towards #9128 and all its related tree of issues. This implements a new `BasicLoop` on top of pthreads synchronization primitives (wrapped in `LittleLock`). This also removes the wonky `callback_ms` function from the interface of the event loop. After #9901 is taking forever to land, I'm going to try to do all this runtime work in much smaller chunks than before. Right now this will not work unless #9901 lands first, but I'm close to landing it (hopefully), and I wanted to go ahead and get this reviewed before throwing it at bors later on down the road. This "pausible idle callback" is also a bit of a weird idea, but it wasn't as difficult to implement as callback_ms so I'm more semi-ok with it.
2013-10-24Implement a basic event loop built on LittleLockAlex Crichton-2/+2
It's not guaranteed that there will always be an event loop to run, and this implementation will serve as an incredibly basic one which does not provide any I/O, but allows the scheduler to still run. cc #9128
2013-10-24auto merge of #10055 : pcwalton/rust/arc-clone-inline, r=alexcrichtonbors-0/+5
r? @thestinger
2013-10-24Another round of test fixes and merge conflictsAlex Crichton-2/+2
2013-10-24Remove std::io once and for all!Alex Crichton-23/+28
2013-10-24Remove std::io from ebmlAlex Crichton-40/+38
2013-10-24Remove even more of std::ioAlex Crichton-1153/+492
Big fish fried here: extra::json most of the compiler extra::io_util removed extra::fileinput removed Fish left to fry extra::ebml
2013-10-24libextra: Make arc::get and arc::new inline too.Patrick Walton-0/+2
Should be a 2x improvement in a Servo test case.
2013-10-24libextra: Make arc clone inlinePatrick Walton-0/+3
2013-10-24extra: Add getter methods to extra::rational::Ratiogifnksm-0/+66
After merging 0ada7c7, user code have not been able to access to `Ratio`'s numerator and denominator fields. In some algorithms, it is needed to get an rational number's numerator or denominator, but keeping these fields private is necessary for guaranteeing that `Ratio` numbers are irreducible. So, I added the getter methods `numer()` and `denom()`. As a bonus, this commit adds utility methods relating to the ratio-integer conversion.
2013-10-23auto merge of #10032 : thestinger/rust/snapshot, r=huonwbors-1/+1
2013-10-23register snapshotsDaniel Micay-1/+1
2013-10-23auto merge of #10034 : sfackler/rust/time, r=alexcrichtonbors-13/+13
These are supposed to be raw C-like structs mirroring time.h's struct tm and struct timespec.
2013-10-23Re-make time struct fields publicSteven Fackler-13/+13
These are supposed to be raw C-like structs mirroring time.h's struct tm and struct timespec.
2013-10-23auto merge of #9810 : huonw/rust/rand3, r=alexcrichtonbors-10/+10
- Adds the `Sample` and `IndependentSample` traits for generating numbers where there are parameters (e.g. a list of elements to draw from, or the mean/variance of a normal distribution). The former takes `&mut self` and the latter takes `&self` (this is the only difference). - Adds proper `Normal` and `Exp`-onential distributions - Adds `Range` which generates `[lo, hi)` generically & properly (via a new trait) replacing the incorrect behaviour of `Rng.gen_integer_range` (this has become `Rng.gen_range` for convenience, it's far more efficient to use `Range` itself) - Move the `Weighted` struct from `std::rand` to `std::rand::distributions` & improve it - optimisations and docs
2013-10-23std::rand: add distributions::Range for generating [lo, hi).Huon Wilson-10/+10
This reifies the computations required for uniformity done by (the old) `Rng.gen_integer_range` (now Rng.gen_range), so that they can be amortised over many invocations, if it is called in a loop. Also, it makes it correct, but using a trait + impls for each type, rather than trying to coerce `Int` + `u64` to do the right thing. This also makes it more extensible, e.g. big integers could & should implement SampleRange.
2013-10-23Removed unnecessary comments and white spaces as suggestedreedlepee-17/+9
2013-10-23Removed Unnecessary comments and white spaces #4386reedlepee-117/+9
2013-10-23Making fields in std and extra : private #4386reedlepee-96/+218
2013-10-22Drop the '2' suffix from logging macrosAlex Crichton-278/+278
Who doesn't like a massive renaming?
2013-10-21Add support for nested commentsGeorges Dubus-26/+26
Fixes #9468.
2013-10-18rustpkg: Make rustpkg tests stop comparing datesTim Chevalier-1/+1
Instead of scrutinizing modification times in rustpkg tests, change output files to be read-only and detect attempts to write to them (hack suggested by Jack). This avoids time granularity problems. As part of this change, I discovered that some dependencies weren't getting written correctly (involving built executables and library files), so this patch fixes that too. This partly addresses #9441, but one test (test_rebuild_when_needed) is still ignored on Linux.
2013-10-18auto merge of #9927 : ↵bors-1/+11
chris-morgan/rust/fix-url-to_str-so-it-includes-the-port, r=huonw Fixes #9451. Fixes chris-morgan/rust-http#16.
2013-10-19Fix extra::url::to_str to include the port.Chris Morgan-1/+11
Fixes #9451. Fixes chris-morgan/rust-http#16.
2013-10-18auto merge of #9926 : Kimundi/rust/future_result_bad_sig, r=huonwbors-5/+3
2013-10-18Made `std::task::TaskBuilder::future_result()` easier to useMarvin Löbel-5/+3
2013-10-17std: Move size/align functions to std::mem. #2240Brian Anderson-5/+5
2013-10-17auto merge of #9897 : thestinger/rust/rusti, r=alexcrichtonbors-144/+0
Closes #9818 Closes #9567 Closes #8924 Closes #8910 Closes #8392 Closes #7692 Closes #7499 Closes #7220 Closes #5038
2013-10-16auto merge of #9846 : cmr/rust/serialize_uuid, r=alexcrichtonbors-0/+31
2013-10-16drop the linenoise libraryDaniel Micay-144/+0
Closes #5038
2013-10-16uuid: serialize test and documentationsCorey Richardson-1/+17