- 26 3月, 2014 2 次提交
-
-
由 Alex Crichton 提交于
These are mostly touchups from the previous commit.
-
由 Patrick Walton 提交于
* native::io * std::char * std::fmt * std::fmt::parse * std::io * std::io::extensions * std::io::net::ip * std::io::net::udp * std::io::net::unix * std::io::pipe * std::num * std::num::f32 * std::num::f64 * std::num::strconv * std::os
-
- 22 3月, 2014 1 次提交
-
-
由 Alex Crichton 提交于
I've found a common use case being to fill a slice (not an owned vector) completely with bytes. It's posible for short reads to happen, and if you're trying to get an exact number of bytes then this helper will be useful.
-
- 21 3月, 2014 1 次提交
-
-
由 Alex Crichton 提交于
These methods can be mistaken for general "read some bytes" utilities when they're actually only meant for reading an exact number of bytes. By renaming them it's much clearer about what they're doing without having to read the documentation. Closes #12892
-
- 20 3月, 2014 1 次提交
-
-
由 Daniel Micay 提交于
Closes #12702
-
- 16 3月, 2014 1 次提交
-
-
由 Alex Crichton 提交于
This commit moves all logging out of the standard library into an external crate. This crate is the new crate which is responsible for all logging macros and logging implementation. A few reasons for this change are: * The crate map has always been a bit of a code smell among rust programs. It has difficulty being loaded on almost all platforms, and it's used almost exclusively for logging and only logging. Removing the crate map is one of the end goals of this movement. * The compiler has a fair bit of special support for logging. It has the __log_level() expression as well as generating a global word per module specifying the log level. This is unfairly favoring the built-in logging system, and is much better done purely in libraries instead of the compiler itself. * Initialization of logging is much easier to do if there is no reliance on a magical crate map being available to set module log levels. * If the logging library can be written outside of the standard library, there's no reason that it shouldn't be. It's likely that we're not going to build the highest quality logging library of all time, so third-party libraries should be able to provide just as high-quality logging systems as the default one provided in the rust distribution. With a migration such as this, the change does not come for free. There are some subtle changes in the behavior of liblog vs the previous logging macros: * The core change of this migration is that there is no longer a physical log-level per module. This concept is still emulated (it is quite useful), but there is now only a global log level, not a local one. This global log level is a reflection of the maximum of all log levels specified. The previously generated logging code looked like: if specified_level <= __module_log_level() { println!(...) } The newly generated code looks like: if specified_level <= ::log::LOG_LEVEL { if ::log::module_enabled(module_path!()) { println!(...) } } Notably, the first layer of checking is still intended to be "super fast" in that it's just a load of a global word and a compare. The second layer of checking is executed to determine if the current module does indeed have logging turned on. This means that if any module has a debug log level turned on, all modules with debug log levels get a little bit slower (they all do more expensive dynamic checks to determine if they're turned on or not). Semantically, this migration brings no change in this respect, but runtime-wise, this will have a perf impact on some code. * A `RUST_LOG=::help` directive will no longer print out a list of all modules that can be logged. This is because the crate map will no longer specify the log levels of all modules, so the list of modules is not known. Additionally, warnings can no longer be provided if a malformed logging directive was supplied. The new "hello world" for logging looks like: #[phase(syntax, link)] extern crate log; fn main() { debug!("Hello, world!"); }
-
- 15 3月, 2014 1 次提交
-
-
由 Alex Crichton 提交于
This commit shreds all remnants of libextra from the compiler and standard distribution. Two modules, c_vec/tempfile, were moved into libstd after some cleanup, and the other modules were moved to separate crates as seen fit. Closes #8784 Closes #12413 Closes #12576
-
- 14 3月, 2014 1 次提交
-
-
由 Alex Crichton 提交于
* Chan<T> => Sender<T> * Port<T> => Receiver<T> * Chan::new() => channel() * constructor returns (Sender, Receiver) instead of (Receiver, Sender) * local variables named `port` renamed to `rx` * local variables named `chan` renamed to `tx` Closes #11765
-
- 13 3月, 2014 3 次提交
-
-
由 Palmer Cox 提交于
Most IO related functions return an IoResult so that the caller can handle failure in whatever way is appropriate. However, the `lines`, `bytes`, and `chars` iterators all supress errors. This means that code that needs to handle errors can't use any of these iterators. All three of these iterators were updated to produce IoResults. Fixes #12368
-
由 Erick Tryzelaar 提交于
-
由 Peter Marheine 提交于
-
- 06 3月, 2014 1 次提交
-
-
由 Kang Seonghoon 提交于
-
- 01 3月, 2014 2 次提交
-
-
由 Alex Crichton 提交于
Formatting via reflection has been a little questionable for some time now, and it's a little unfortunate that one of the standard macros will silently use reflection when you weren't expecting it. This adds small bits of code bloat to libraries, as well as not always being necessary. In light of this information, this commit switches assert_eq!() to using {} in the error message instead of {:?}. In updating existing code, there were a few error cases that I encountered: * It's impossible to define Show for [T, ..N]. I think DST will alleviate this because we can define Show for [T]. * A few types here and there just needed a #[deriving(Show)] * Type parameters needed a Show bound, I often moved this to `assert!(a == b)` * `Path` doesn't implement `Show`, so assert_eq!() cannot be used on two paths. I don't think this is much of a regression though because {:?} on paths looks awful (it's a byte array). Concretely speaking, this shaved 10K off a 656K binary. Not a lot, but sometime significant for smaller binaries.
-
由 Alex Crichton 提交于
This lowers the #[allow(missing_doc)] directive into some of the lower modules which are less mature. Most I/O modules now require comprehensive documentation.
-
- 24 2月, 2014 3 次提交
-
-
由 Alex Crichton 提交于
The std::run module is a relic from a standard library long since past, and there's not much use to having two modules to execute processes with where one is slightly more convenient. This commit merges the two modules, moving lots of functionality from std::run into std::io::process and then deleting std::run. New things you can find in std::io::process are: * Process::new() now only takes prog/args * Process::configure() takes a ProcessConfig * Process::status() is the same as run::process_status * Process::output() is the same as run::process_output * I/O for spawned tasks is now defaulted to captured in pipes instead of ignored * Process::kill() was added (plus an associated green/native implementation) * Process::wait_with_output() is the same as the old finish_with_output() * destroy() is now signal_exit() * force_destroy() is now signal_kill() Closes #2625 Closes #10016
-
由 Alex Crichton 提交于
This commit changes the ToStr trait to: impl<T: fmt::Show> ToStr for T { fn to_str(&self) -> ~str { format!("{}", *self) } } The ToStr trait has been on the chopping block for quite awhile now, and this is the final nail in its coffin. The trait and the corresponding method are not being removed as part of this commit, but rather any implementations of the `ToStr` trait are being forbidden because of the generic impl. The new way to get the `to_str()` method to work is to implement `fmt::Show`. Formatting into a `&mut Writer` (as `format!` does) is much more efficient than `ToStr` when building up large strings. The `ToStr` trait forces many intermediate allocations to be made while the `fmt::Show` trait allows incremental buildup in the same heap allocated buffer. Additionally, the `fmt::Show` trait is much more extensible in terms of interoperation with other `Writer` instances and in more situations. By design the `ToStr` trait requires at least one allocation whereas the `fmt::Show` trait does not require any allocations. Closes #8242 Closes #9806
-
由 zslayton 提交于
Closes #12386. Removed 'pub mod' doc-comments in std::io's mod.rs file. Added summary doc-comments to test.rs, util.rs and stdio.rs.
-
- 23 2月, 2014 1 次提交
-
-
由 Brian Anderson 提交于
Most of this stuff is irrelevant implementation notes from last year. This trims out the stuff that isn't appropriate for user-facing docs.
-
- 22 2月, 2014 1 次提交
-
-
由 Brendan Zabarauskas 提交于
This is in preparation to remove the implementations of ToStrRadix in integers, and to remove the associated logic from `std::num::strconv`. The parts that still need to be liberated are: - `std::fmt::Formatter::runplural` - `num::{bigint, complex, rational}`
-
- 21 2月, 2014 2 次提交
-
-
由 Alex Crichton 提交于
This "bubble up an error" macro was originally named if_ok! in order to get it landed, but after the fact it was discovered that this name is not exactly desirable. The name `if_ok!` isn't immediately clear that is has much to do with error handling, and it doesn't look fantastic in all contexts (if if_ok!(...) {}). In general, the agreed opinion about `if_ok!` is that is came in as subpar. The name `try!` is more invocative of error handling, it's shorter by 2 letters, and it looks fitting in almost all circumstances. One concern about the word `try!` is that it's too invocative of exceptions, but the belief is that this will be overcome with documentation and examples. Close #12037
-
由 Alex Crichton 提交于
One of the most common ways to use the stdin stream is to read it line by line for a small program. In order to facilitate this common usage pattern, this commit changes the stdin() function to return a BufferedReader by default. A new `stdin_raw()` method was added to get access to the raw unbuffered stream. I have not changed the stdout or stderr methods because they are currently unable to flush in their destructor, but #12403 should have just fixed that.
-
- 18 2月, 2014 1 次提交
-
-
由 Huon Wilson 提交于
-
- 15 2月, 2014 1 次提交
-
-
由 Palmer Cox 提交于
RefReader and RefWriter allow a caller to pass a Reader or Writer instance by reference to generic functions that are expecting arguments by value.
-
- 12 2月, 2014 2 次提交
-
-
由 Alex Crichton 提交于
This adopts the rules posted in #10432: 1. If a seek position is negative, then an error is generated 2. Seeks beyond the end-of-file are allowed. Future writes will fill the gap with data and future reads will return errors. 3. Seeks within the bounds of a file are fine. Closes #10432
-
由 Niko Matsakis 提交于
-
- 09 2月, 2014 1 次提交
-
-
由 gifnksm 提交于
Add `std::io::Chars` iterator and `Buffer#chars()` method
-
- 08 2月, 2014 1 次提交
-
-
由 Huon Wilson 提交于
Poly and String have polymorphic `impl`s and so require different method names.
-
- 04 2月, 2014 4 次提交
-
-
由 Alex Crichton 提交于
-
由 Alex Crichton 提交于
* Stop referencing io_error * Start changing "Failure" sections to "Error" sections * Update all doc examples to work.
-
由 Alex Crichton 提交于
-
由 Alex Crichton 提交于
* All I/O now returns IoResult<T> = Result<T, IoError> * All formatting traits now return fmt::Result = IoResult<()> * The if_ok!() macro was added to libstd
-
- 01 2月, 2014 1 次提交
-
-
由 Virgile Andreani 提交于
-
- 29 1月, 2014 1 次提交
-
-
由 Virgile Andreani 提交于
-
- 27 1月, 2014 1 次提交
-
-
由 Salem Talha 提交于
-
- 26 1月, 2014 1 次提交
-
-
由 Huon Wilson 提交于
These are either returned from public functions, and really should appear in the documentation, but don't since they're private, or are implementation details that are currently public.
-
- 25 1月, 2014 1 次提交
-
-
由 Chris Wong 提交于
The following are renamed: * `min_value` => `MIN` * `max_value` => `MAX` * `bits` => `BITS` * `bytes` => `BYTES` Fixes #10010.
-
- 22 1月, 2014 2 次提交
-
-
由 Simon Sapin 提交于
[std::str] Rename from_utf8_owned_opt() to from_utf8_owned(), drop the old from_utf8_owned() behavior
-
由 Simon Sapin 提交于
-
- 18 1月, 2014 2 次提交
-
-
由 Palmer Cox 提交于
Rename existing iterators to get rid of the Iterator suffix and to give them names that better describe the things being iterated over.
-
由 Alex Crichton 提交于
* Reexport io::mem and io::buffered structs directly under io, make mem/buffered private modules * Remove with_mem_writer * Remove DEFAULT_CAPACITY and use DEFAULT_BUF_SIZE (in io::buffered)
-