summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2014-05-08Clean up unused importsKevin Ballard-12/+5
2014-05-08Handle fallout in libnativeKevin Ballard-1/+1
API Changes: - GetAddrInfoRequest::run() returns Result<Vec<..>, ..> - Process::spawn() returns Result(.., Vec<..>), ..>
2014-05-08Handle fallout for vector additionKevin Ballard-3/+38
Adding two vectors now results in a Vec<T> instead of a ~[T]. Implement Add on Vec<T>.
2014-05-08Handle fallout in io::net::addrinfo, io::process, and rt::rtioKevin Ballard-6/+6
API Changes: - get_host_addresses() returns IoResult<Vec<IpAddr>> - Process.extra_io is Vec<Option<io::PipeStream>>
2014-05-08Handle fallout in osKevin Ballard-44/+47
os::env(), os::args(), and related functions now use Vec<T> instead of ~[T].
2014-05-08Handle fallout in iter, option, result, and sync::arcKevin Ballard-3/+3
API changes: - UnsafeArc::newN() returns Vec<UnsafeArc<T>>
2014-05-08Handle fallout in std::ascii and std::strconvKevin Ballard-46/+59
API changes: - OwnedAsciiCast returns Vec<Ascii> instead of ~[Ascii] - OwnedAsciiCast is implemented on Vec<u8> - AsciiStr.to_lower/upper() returns Vec<Ascii> - IntoBytes::into_bytes() returns Vec<u8> - float_to_str_bytes_common() returns (Vec<u8>, bool)
2014-05-08Handle fallout in std::strbufKevin Ballard-5/+2
2014-05-08Even more fallout, this time in std::strKevin Ballard-92/+85
- StrSlice.to_utf16() now returns a Vec<u8>. - Other miscellaneous fallout in std::str.
2014-05-08More fallout from removing FromIterator on ~[T]Kevin Ballard-42/+42
2014-05-08Move slice::raw::from_buf_raw() to vec::raw::from_buf()Kevin Ballard-56/+36
Change from_buf_raw() to return a Vec<T> instead of a ~[T]. As such, it belongs in vec, in the newly-created vec::raw module.
2014-05-08Rename slice::unzip() to vec::unzip()Kevin Ballard-33/+35
unzip() has nothing to do with slices, so it belongs in vec.
2014-05-08More fallout from removing FromIterator on ~[T]Kevin Ballard-57/+57
A few methods in slice that used to return ~[T] now return Vec<T>: - VectorVector.concat/connect_vec() returns Vec<T> - slice::unzip() returns (Vec<T>, Vec<U>) - ImmutableCloneableVector.partitioned() returns (Vec<T>, Vec<T>) - OwnedVector.partition() returns (Vec<T>, Vec<T>)
2014-05-08Rewrite &[T].to_owned() to allocate directlyKevin Ballard-9/+23
This used to create a Vec<T> and then call .move_iter().collect() to convert to a ~[T]. We can't do that anymore, so construct the ~[T] in place instead. This has the added benefit of avoiding an unnecessary memory copy (from the Vec<T> to the ~[T]).
2014-05-08std: Ignore a flaky test on freebsdAlex Crichton-13/+18
This test runs successfully manually, but the bots are having trouble getting this test to pass. Ignore it on freebsd for now.
2014-05-08std: Extract format string parsing out of libstdAlex Crichton-1009/+80
This code does not belong in libstd, and rather belongs in a dedicated crate. In the future, the syntax::ext::format module should move to the fmt_macros crate (hence the name of the crate), but for now the fmt_macros crate will only contain the format string parser. The entire fmt_macros crate is marked #[experimental] because it is not meant for general consumption, only the format!() interface is officially supported, not the internals. This is a breaking change for anyone using the internals of std::fmt::parse. Some of the flags have moved to std::fmt::rt, while the actual parsing support has all moved to the fmt_macros library. [breaking-change]
2014-05-08std: Mark timeout methods experimentalAlex Crichton-0/+9
This was intended as part of the I/O timeouts commit, but it was mistakenly forgotten. The type of the timeout argument is not guaranteed to remain constant into the future.
2014-05-08auto merge of #13835 : alexcrichton/rust/localdata, r=brsonbors-355/+197
This commit brings the local_data api up to modern rust standards with a few key improvements: * All functionality is now exposed as a method on the keys themselves. Instead of importing std::local_data, you now use "key.set()" and "key.get()". * All closures have been removed in favor of RAII functionality. This means that get() and get_mut() no long require closures, but rather return Option<SmartPointer> where the smart pointer takes care of relinquishing the borrow and also implements the necessary Deref traits * The modify() function was removed to cut the local_data interface down to its bare essentials (similarly to how RefCell removed set/get). [breaking-change]
2014-05-07std: Modernize the local_data apiAlex Crichton-356/+197
This commit brings the local_data api up to modern rust standards with a few key improvements: * The `pop` and `set` methods have been combined into one method, `replace` * The `get_mut` method has been removed. All interior mutability should be done through `RefCell`. * All functionality is now exposed as a method on the keys themselves. Instead of importing std::local_data, you now use "key.replace()" and "key.get()". * All closures have been removed in favor of RAII functionality. This means that get() and get_mut() no long require closures, but rather return Option<SmartPointer> where the smart pointer takes care of relinquishing the borrow and also implements the necessary Deref traits * The modify() function was removed to cut the local_data interface down to its bare essentials (similarly to how RefCell removed set/get). [breaking-change]
2014-05-07native: Implement timeouts for windows pipesAlex Crichton-1/+8
This is the last remaining networkig object to implement timeouts for. This takes advantage of the CancelIo function and the already existing asynchronous I/O functionality of pipes.
2014-05-07std: Add I/O timeouts to networking objectsAlex Crichton-15/+419
These timeouts all follow the same pattern as established by the timeouts on acceptors. There are three methods: set_timeout, set_read_timeout, and set_write_timeout. Each of these sets a point in the future after which operations will time out. Timeouts with cloned objects are a little trickier. Each object is viewed as having its own timeout, unaffected by other objects' timeouts. Additionally, timeouts do not propagate when a stream is cloned or when a cloned stream has its timeouts modified. This commit is just the public interface which will be exposed for timeouts, the implementation will come in later commits.
2014-05-07auto merge of #13964 : alexcrichton/rust/more-buffers, r=brsonbors-1/+63
This will allow methods like read_line() on RefReader, LimitReader, etc.
2014-05-07auto merge of #13751 : alexcrichton/rust/io-close-read, r=brsonbors-14/+205
Two new methods were added to TcpStream and UnixStream: fn close_read(&mut self) -> IoResult<()>; fn close_write(&mut self) -> IoResult<()>; These two methods map to shutdown()'s behavior (the system call on unix), closing the reading or writing half of a duplex stream. These methods are primarily added to allow waking up a pending read in another task. By closing the reading half of a connection, all pending readers will be woken up and will return with EndOfFile. The close_write() method was added for symmetry with close_read(), and I imagine that it will be quite useful at some point. Implementation-wise, librustuv got the short end of the stick this time. The native versions just delegate to the shutdown() syscall (easy). The uv versions can leverage uv_shutdown() for tcp/unix streams, but only for closing the writing half. Closing the reading half is done through some careful dancing to wake up a pending reader. As usual, windows likes to be different from unix. The windows implementation uses shutdown() for sockets, but shutdown() is not available for named pipes. Instead, CancelIoEx was used with same fancy synchronization to make sure everyone knows what's up. cc #11165
2014-05-07std: Add close_{read,write}() methods to I/OAlex Crichton-14/+205
Two new methods were added to TcpStream and UnixStream: fn close_read(&mut self) -> IoResult<()>; fn close_write(&mut self) -> IoResult<()>; These two methods map to shutdown()'s behavior (the system call on unix), closing the reading or writing half of a duplex stream. These methods are primarily added to allow waking up a pending read in another task. By closing the reading half of a connection, all pending readers will be woken up and will return with EndOfFile. The close_write() method was added for symmetry with close_read(), and I imagine that it will be quite useful at some point. Implementation-wise, librustuv got the short end of the stick this time. The native versions just delegate to the shutdown() syscall (easy). The uv versions can leverage uv_shutdown() for tcp/unix streams, but only for closing the writing half. Closing the reading half is done through some careful dancing to wake up a pending reader. As usual, windows likes to be different from unix. The windows implementation uses shutdown() for sockets, but shutdown() is not available for named pipes. Instead, CancelIoEx was used with same fancy synchronization to make sure everyone knows what's up. cc #11165
2014-05-07std: Doc typosBrian Anderson-3/+4
2014-05-07Test fixes and rebase conflictsAlex Crichton-51/+12
2014-05-07core: Move Option::expect to libstd from libcoreAlex Crichton-4/+172
See #14008 for more details
2014-05-07core: Inherit the cell moduleAlex Crichton-318/+3
2014-05-07core: Add unwrap()/unwrap_err() methods to ResultAlex Crichton-6/+327
These implementations must live in libstd right now because the fmt module has not been migrated yet. This will occur in a later PR. Just to be clear, there are new extension traits, but they are not necessary once the std::fmt module has migrated to libcore, which is a planned migration in the future.
2014-05-07core: Inherit the result moduleAlex Crichton-784/+21
The unwrap()/unwrap_err() methods are temporarily removed, and will be added back in the next commit.
2014-05-07core: Add a limited implementation of failureAlex Crichton-32/+12
This adds an small of failure to libcore, hamstrung by the fact that std::fmt hasn't been migrated yet. A few asserts were re-worked to not use std::fmt features, but these asserts can go back to their original form once std::fmt has migrated. The current failure implementation is to just have some symbols exposed by std::rt::unwind that are linked against by libcore. This is an explicit circular dependency, unfortunately. This will be officially supported in the future through compiler support with much nicer failure messages. Additionally, there are two depended-upon symbols today, but in the future there will only be one (once std::fmt has migrated).
2014-05-07std: Remove a glob to get std to compileAlex Crichton-1/+1
2014-05-07core: Inherit possible string functionalityAlex Crichton-1945/+122
This moves as much allocation as possible from teh std::str module into core::str. This includes essentially all non-allocating functionality, mostly iterators and slicing and such. This primarily splits the Str trait into only having the as_slice() method, adding a new StrAllocating trait to std::str which contains the relevant new allocation methods. This is a breaking change if any of the methods of "trait Str" were overriden. The old functionality can be restored by implementing both the Str and StrAllocating traits. [breaking-change]
2014-05-07core: Inherit necessary unicode functionalityAlex Crichton-4991/+1
The unicode module remains private, but the normalization iterators require an allocation, so some functionality needs to remain in libstd
2014-05-07core: Inherit non-allocating slice functionalityAlex Crichton-1554/+53
This commit adds a new trait, MutableVectorAllocating, which represents functions on vectors which can allocate. This is another extension trait to slices which should be removed once a lang item exists for the ~ allocation.
2014-05-07core: Inherit the specific numeric modulesAlex Crichton-1506/+77
This implements all traits inside of core::num for all the primitive types, removing all the functionality from libstd. The std modules reexport all of the necessary items from the core modules.
2014-05-07core: Inherit what's possible from the num moduleAlex Crichton-849/+15
This strips out all string-related functionality from the num module. The inherited functionality is all that will be implemented in libcore (for now). Primarily, libcore will not implement the Float trait or any string-related functionality. It may be possible to migrate string parsing functionality into libcore in the future, but for now it will remain in libstd. All functionality in core::num is reexported in std::num.
2014-05-07core: Inhert ~/@/& cmp traits, remove old modulesAlex Crichton-150/+1
This commit removes the std::{managed, reference} modules. The modules serve essentially no purpose, and the only free function removed was `managed::ptr_eq` which can be achieved by comparing references. [breaking-change]
2014-05-07core: Inherit the cmp moduleAlex Crichton-299/+12
This removes the TotalOrd and TotalEq implementation macros, they will be added later to the numeric modules (where the other comparison implementations live).
2014-05-07core: Inherit the iter moduleAlex Crichton-3091/+15
2014-05-07core: Inherit the option moduleAlex Crichton-883/+10
2014-05-07core: Inherit the bool moduleAlex Crichton-305/+36
2014-05-07core: Inherit the tuple moduleAlex Crichton-351/+31
2014-05-07core: Inherit the clone moduleAlex Crichton-172/+1
2014-05-07core: Inherit the unit moduleAlex Crichton-53/+6
2014-05-07core: Inherit the default moduleAlex Crichton-27/+1
2014-05-07core: Inherit the raw moduleAlex Crichton-115/+1
2014-05-07core: Inherit the any moduleAlex Crichton-324/+9
2014-05-07core: Inherit the finally moduleAlex Crichton-160/+2
2014-05-07core: Inherit the char moduleAlex Crichton-846/+1