about summary refs log tree commit diff
path: root/src/libstd/io/net
AgeCommit message (Collapse)AuthorLines
2014-12-06libstd: remove unnecessary `to_string()` callsJorge Aparicio-3/+3
2014-12-05Utilize fewer reexportsCorey Farwell-8/+11
In regards to: https://github.com/rust-lang/rust/issues/19253#issuecomment-64836729 This commit: * Changes the #deriving code so that it generates code that utilizes fewer reexports (in particur Option::* and Result::*), which is necessary to remove those reexports in the future * Changes other areas of the codebase so that fewer reexports are utilized
2014-11-26/*! -> //!Steve Klabnik-21/+13
Sister pull request of https://github.com/rust-lang/rust/pull/19288, but for the other style of block doc comment.
2014-11-26auto merge of #19176 : aturon/rust/stab-iter, r=alexcrichtonbors-3/+2
This is an initial pass at stabilizing the `iter` module. The module is fairly large, but is also pretty polished, so most of the stabilization leaves things as they are. Some changes: * Due to the new object safety rules, various traits needs to be split into object-safe traits and extension traits. This includes `Iterator` itself. While splitting up the traits adds some complexity, it will also increase flexbility: once we have automatic impls of `Trait` for trait objects over `Trait`, then things like the iterator adapters will all work with trait objects. * Iterator adapters that use up the entire iterator now take it by value, which makes the semantics more clear and helps catch bugs. Due to the splitting of Iterator, this does not affect trait objects. If the underlying iterator is still desired for some reason, `by_ref` can be used. (Note: this change had no fallout in the Rust distro except for the useless mut lint.) * In general, extension traits new and old are following an [in-progress convention](rust-lang/rfcs#445). As such, they are marked `unstable`. * As usual, anything involving closures is `unstable` pending unboxed closures. * A few of the more esoteric/underdeveloped iterator forms (like `RandomAccessIterator` and `MutableDoubleEndedIterator`, along with various unfolds) are left experimental for now. * The `order` submodule is left `experimental` because it will hopefully be replaced by generalized comparison traits. * "Leaf" iterators (like `Repeat` and `Counter`) are uniformly constructed by free fns at the module level. That's because the types are not otherwise of any significance (if we had `impl Trait`, you wouldn't want to define a type at all). Closes #17701 Due to renamings and splitting of traits, this is a: [breaking-change]
2014-11-26auto merge of #19169 : aturon/rust/fds, r=alexcrichtonbors-0/+47
This PR adds some internal infrastructure to allow the private `std::sys` module to access internal representation details of `std::io`. It then exposes those details in two new, platform-specific API surfaces: `std::os::unix` and `std::os::windows`. To start with, these will provide the ability to extract file descriptors, HANDLEs, SOCKETs, and so on from `std::io` types. More functionality, and more specific platforms (e.g. `std::os::linux`) will be added over time. Closes #18897
2014-11-25Fallout from stabilizationAaron Turon-3/+2
2014-11-24Don't call drop in tcpstream docsSteve Klabnik-6/+10
This suggests that you must call it, which is normally not what you want to do.
2014-11-21sys: reveal std::io representation to sys moduleAaron Turon-0/+47
This commit adds a `AsInner` trait to `sys_common` and provides implementations on many `std::io` types. This is a building block for exposing platform-specific APIs that hook into `std::io` types.
2014-11-17Switch to purely namespaced enumsSteven Fackler-0/+6
This breaks code that referred to variant names in the same namespace as their enum. Reexport the variants in the old location or alter code to refer to the new locations: ``` pub enum Foo { A, B } fn main() { let a = A; } ``` => ``` pub use self::Foo::{A, B}; pub enum Foo { A, B } fn main() { let a = A; } ``` or ``` pub enum Foo { A, B } fn main() { let a = Foo::A; } ``` [breaking-change]
2014-11-17Fix fallout from coercion removalNick Cameron-150/+150
2014-11-16rollup merge of #18985: alexcrichton/issue-18900Jakub Bukaj-24/+22
2014-11-16Move FromStr to core::strBrendan Zabarauskas-3/+2
2014-11-15std: Fix a flaky test on OSX 10.10Alex Crichton-24/+22
This test was somewhat sketchy already with a `loop` around `write`, so this just adds some explicit synchronization to only call `write` once and guarantee that the error happens. Closes #18900
2014-11-08Runtime removal: refactor pipes and networkingAaron Turon-213/+94
This patch continues the runtime removal by moving pipe and networking-related code into `sys`. Because this eliminates APIs in `libnative` and `librustrt`, it is a: [breaking-change] This functionality is likely to be available publicly, in some form, from `std` in the future.
2014-11-06Prelude: rename and consolidate extension traitsAaron Turon-2/+2
This commit renames a number of extension traits for slices and string slices, now that they have been refactored for DST. In many cases, multiple extension traits could now be consolidated. Further consolidation will be possible with generalized where clauses. The renamings are consistent with the [new `-Prelude` suffix](https://github.com/rust-lang/rfcs/pull/344). There are probably a few more candidates for being renamed this way, but that is left for API stabilization of the relevant modules. Because this renames traits, it is a: [breaking-change] However, I do not expect any code that currently uses the standard library to actually break. Closes #17917
2014-11-05Fixed not compiling code in docstringVladimir Matveev-2/+2
2014-11-05Added more documentation on ToSocketAddr traitVladimir Matveev-3/+92
2014-11-05Fixed tidy errorsVladimir Matveev-3/+3
2014-11-05Fixed other tests to pass make checkVladimir Matveev-6/+3
2014-11-05Migrated io::net::udp over to ToSocketAddrVladimir Matveev-20/+34
UdpSocket constructor methods now use ToSocketAddr trait instead of SocketAddr. [breaking-change]
2014-11-05Switched io::net::tcp to use ToSocketAddrVladimir Matveev-227/+130
TcpListener and TcpStream are converted to use ToSocketAddr trait in their constructor methods. [breaking-change]
2014-11-05Added ToSocketAddr traitVladimir Matveev-0/+151
This commit adds ToSocketAddr trait to std::io::net::ip module. This trait is used for generic conversion from different types (strings, (string, u16) tuples, etc.) into a SocketAddr instance. It supports multiple output SocketAddresses when it is appropriate (e.g. DNS name resolution). This trait is going to be used by TcpStream, TcpListener and UdpSocket structures.
2014-11-01collections: Remove all collections traitsAlex Crichton-2/+1
As part of the collections reform RFC, this commit removes all collections traits in favor of inherent methods on collections themselves. All methods should continue to be available on all collections. This is a breaking change with all of the collections traits being removed and no longer being in the prelude. In order to update old code you should move the trait implementations to inherent implementations directly on the type itself. Note that some traits had default methods which will also need to be implemented to maintain backwards compatibility. [breaking-change] cc #18424
2014-10-30rollup merge of #18398 : aturon/lint-conventions-2Alex Crichton-4/+4
Conflicts: src/libcollections/slice.rs src/libcore/failure.rs src/libsyntax/parse/token.rs src/test/debuginfo/basic-types-mut-globals.rs src/test/debuginfo/simple-struct.rs src/test/debuginfo/trait-pointers.rs
2014-10-30rollup merge of #18443 : alexcrichton/deref-vec-and-stringAlex Crichton-0/+1
2014-10-29collections: impl Deref for Vec/StringAlex Crichton-0/+1
This commit adds the following impls: impl<T> Deref<[T]> for Vec<T> impl<T> DerefMut<[T]> for Vec<T> impl Deref<str> for String This commit also removes all duplicated inherent methods from vectors and strings as implementations will now silently call through to the slice implementation. Some breakage occurred at std and beneath due to inherent methods removed in favor of those in the slice traits and std doesn't use its own prelude, cc #18424
2014-10-29Rename fail! to panic!Steve Klabnik-43/+43
https://github.com/rust-lang/rfcs/pull/221 The current terminology of "task failure" often causes problems when writing or speaking about code. You often want to talk about the possibility of an operation that returns a Result "failing", but cannot because of the ambiguity with task failure. Instead, you have to speak of "the failing case" or "when the operation does not succeed" or other circumlocutions. Likewise, we use a "Failure" header in rustdoc to describe when operations may fail the task, but it would often be helpful to separate out a section describing the "Err-producing" case. We have been steadily moving away from task failure and toward Result as an error-handling mechanism, so we should optimize our terminology accordingly: Result-producing functions should be easy to describe. To update your code, rename any call to `fail!` to `panic!` instead. Assuming you have not created your own macro named `panic!`, this will work on UNIX based systems: grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g' You can of course also do this by hand. [breaking-change]
2014-10-28Update code with new lint namesAaron Turon-4/+4
2014-10-25Deprecate UdpStreamJulian Orth-0/+12
2014-10-25Make UdpStream block until the next non-empty msg.Julian Orth-13/+20
2014-10-19Remove a large amount of deprecated functionalityAlex Crichton-19/+0
Spring cleaning is here! In the Fall! This commit removes quite a large amount of deprecated functionality from the standard libraries. I tried to ensure that only old deprecated functionality was removed. This is removing lots and lots of deprecated features, so this is a breaking change. Please consult the deprecation messages of the deleted code to see how to migrate code forward if it still needs migration. [breaking-change]
2014-10-16libstd: Remove all uses of {:?}.Luqman Aden-1/+1
2014-10-13Clean up rustc warnings.NODA, Kai-4/+0
compiletest: compact "linux" "macos" etc.as "unix". liballoc: remove a superfluous "use". libcollections: remove invocations of deprecated methods in favor of their suggested replacements and use "_" for a loop counter. libcoretest: remove invocations of deprecated methods; also add "allow(deprecated)" for testing a deprecated method itself. libglob: use "cfg_attr". libgraphviz: add a test for one of data constructors. libgreen: remove a superfluous "use". libnum: "allow(type_overflow)" for type cast into u8 in a test code. librustc: names of static variables should be in upper case. libserialize: v[i] instead of get(). libstd/ascii: to_lowercase() instead of to_lower(). libstd/bitflags: modify AnotherSetOfFlags to use i8 as its backend. It will serve better for testing various aspects of bitflags!. libstd/collections: "allow(deprecated)" for testing a deprecated method itself. libstd/io: remove invocations of deprecated methods and superfluous "use". Also add #[test] where it was missing. libstd/num: introduce a helper function to effectively remove invocations of a deprecated method. libstd/path and rand: remove invocations of deprecated methods and superfluous "use". libstd/task and libsync/comm: "allow(deprecated)" for testing a deprecated method itself. libsync/deque: remove superfluous "unsafe". libsync/mutex and once: names of static variables should be in upper case. libterm: introduce a helper function to effectively remove invocations of a deprecated method. We still see a few warnings about using obsoleted native::task::spawn() in the test modules for libsync. I'm not sure how I should replace them with std::task::TaksBuilder and native::task::NativeTaskBuilder (dependency to libstd?) Signed-off-by: NODA, Kai <nodakai@gmail.com>
2014-10-10improve the performance of the vec![] macroDaniel Micay-1/+0
Closes #17865
2014-10-07Put slicing syntax behind a feature gate.Nick Cameron-15/+18
[breaking-change] If you are using slicing syntax you will need to add #![feature(slicing_syntax)] to your crate.
2014-10-07Use slice syntax instead of slice_to, etc.Nick Cameron-4/+4
2014-10-02Revert "Use slice syntax instead of slice_to, etc."Aaron Turon-4/+4
This reverts commit 40b9f5ded50ac4ce8c9323921ec556ad611af6b7.
2014-10-02Revert "Put slicing syntax behind a feature gate."Aaron Turon-18/+15
This reverts commit 95cfc35607ccf5f02f02de56a35a9ef50fa23a82.
2014-10-02Put slicing syntax behind a feature gate.Nick Cameron-15/+18
[breaking-change] If you are using slicing syntax you will need to add #![feature(slicing_syntax)] to your crate.
2014-10-02Use slice syntax instead of slice_to, etc.Nick Cameron-4/+4
2014-10-01Remove iotest macroAaron Turon-166/+267
This commit removes the `iotest!` macro from `std::io`. The macro was primarily used to ensure that all io-related tests were run on both libnative and libgreen/librustuv. However, now that the librustuv stack is being removed, the macro is no longer needed. See the [runtime removal RFC](https://github.com/rust-lang/rfcs/pull/230) for more context. [breaking-change]
2014-09-30Fix libstdSteven Fackler-1/+1
2014-09-27auto merge of #17506 : sfackler/rust/cfg-attr, r=alexcrichtonbors-3/+3
cc #17490 Reopening of #16230
2014-09-25Ignore two I/O tests that are failing on the win32 botBrian Anderson-0/+2
2014-09-23Deprecate `#[ignore(cfg(...))]`Steven Fackler-3/+3
Replace `#[ignore(cfg(a, b))]` with `#[cfg_attr(all(a, b), ignore)]`
2014-09-21Remove #[allow(deprecated)] from libstdAlex Crichton-4/+12
2014-09-17rollup merge of #17297 : treeman/net-unixAlex Crichton-4/+3
2014-09-16Fallout from renamingAaron Turon-5/+5
2014-09-16Rename std::io::net::unix to std::io::net::pipe.Jonas Hietala-4/+3
Renamed as we may support pipes for other platforms. Closes #12093 [breaking-change]
2014-08-28auto merge of #16626 : ruud-v-a/rust/duration-reform, r=brsonbors-3/+3
This changes the internal representation of `Duration` from days: i32, secs: i32, nanos: u32 to secs: i64, nanos: i32 This resolves #16466. Note that `nanos` is an `i32` and not `u32` as suggested, because `i32` is easier to deal with, and it is not exposed anyway. Some methods now take `i64` instead of `i32` due to the increased range. Some methods, like `num_milliseconds`, now return an `Option<i64>` instead of `i64`, because the range of `Duration` is now larger than e.g. 2^63 milliseconds. A few remarks: - Negating `MIN` is impossible. I chose to return `MAX` as `-MIN`, but it is one nanosecond less than the actual negation. Is this the desired behaviour? - In `std::io::timer`, some functions accept a `Duration`, which is internally converted into a number of milliseconds. However, the range of `Duration` is now larger than 2^64 milliseconds. There is already a FIXME in the file that this should be addressed (without a ticket number though). I chose to silently use 0 ms if the duration is too long. Is that right, as long as the backend still uses milliseconds? - Negative durations are not formatted correctly, but they were not formatted correctly before either.