about summary refs log tree commit diff
path: root/src/libstd/rt/io
AgeCommit message (Collapse)AuthorLines
2013-09-03auto merge of #8954 : anasazi/rust/tcp-acceptor, r=catamorphismbors-61/+111
The Listener trait takes two type parameters, the type of connection and the type of Acceptor, and specifies only one method, listen, which consumes the listener and produces an Acceptor. The Acceptor trait takes one type parameter, the type of connection, and defines two methods. The accept() method waits for an incoming connection attempt and returns the result. The incoming() method creates an iterator over incoming connections and is a default method. Example: ```rust let listener = TcpListener.bind(addr); // Bind to a socket let acceptor = listener.listen(); // Start the listener for stream in acceptor.incoming() { // Process incoming connections forever (a failure will kill the task). } ``` Closes #8689
2013-09-03rt::io: Rename Bytes to ByteIterator and add note about iterationblake2-ppc-8/+14
2013-09-02Implement BufReaderSteven Fackler-3/+39
2013-09-02rt::io: Add Bytes iterator for Readerblake2-ppc-1/+83
An iterator that simply calls `.read_bytes()` each iteration. I think choosing to own the Reader value and implementing Decorator to allow extracting it is the most generically useful. The Reader type variable can of course be some kind of reference type that implements Reader.
2013-08-29auto merge of #8819 : vadimcn/rust/unit-tests, r=brsonbors-0/+11
Some of the tests are failing. I've only managed to fix 'memory_map_file', the rest are up for grabs... Fixes #5261.
2013-08-29Revert "auto merge of #8645 : alexcrichton/rust/issue-6436-run-non-blocking, ↵Brian Anderson-84/+7
r=brson" This reverts commit b8d1fa399402c71331aefd634d710004e00b73a6, reversing changes made to f22b4b169854c8a4ba86c16ee43327d6bcf94562. Conflicts: mk/rt.mk src/libuv
2013-08-28Turned off libstd unit tests that currently fail on Windows.Vadim Chugunov-0/+11
2013-08-27Implement process bindings to libuvAlex Crichton-6/+83
Closes #6436
2013-08-27Upgrade libuv to the current master + our patchesAlex Crichton-1/+1
There were two main differences with the old libuv and the master version: 1. The uv_last_error function is now gone. The error code returned by each function is the "last error" so now a UvError is just a wrapper around a c_int. 2. The repo no longer includes a makefile, and the build system has change. According to the build directions on joyent/libuv, this now downloads a `gyp` program into the `libuv/build` directory and builds using that. This shouldn't add any dependences on autotools or anything like that. Closes #8407 Closes #6567 Closes #6315
2013-08-27librustc: Fix merge falloutPatrick Walton-2/+2
2013-08-27librustc: Ensure that type parameters are in the right positions in paths.Patrick Walton-21/+41
This removes the stacking of type parameters that occurs when invoking trait methods, and fixes all places in the standard library that were relying on it. It is somewhat awkward in places; I think we'll probably want something like the `Foo::<for T>::new()` syntax.
2013-08-24auto merge of #8607 : sfackler/rust/extensions, r=brsonbors-123/+122
The method names in std::rt::io::extensions::WriterByteConversions are the same as those in std::io::WriterUtils and a resolve error causes rustc to fail after trying to find an impl of io::Writer instead of trying to look for rt::io::Writer as well.
2013-08-23Rename {Reader,Writer}ByteConversions methodsSteven Fackler-123/+122
The method names in std::rt::io::extensions::WriterByteConversions are the same as those in std::io::WriterUtils and a resolve error causes rustc to fail after trying to find an impl of io::Writer instead of trying to look for rt::io::Writer as well. Same goes for ReaderByteConversions.
2013-08-23auto merge of #8691 : anasazi/rust/fix-timer-interface, r=brsonbors-7/+2
Resolves #8687.
2013-08-22auto merge of #8596 : vadimcn/rust/master, r=alexcrichtonbors-2/+0
This resolves issue #908. Notable changes: - On Windows, LLVM integrated assembler emits bad stack unwind tables when segmented stacks are enabled. However, unwind info directives in the assembly output are correct, so we generate assembly first and then run it through an external assembler, just like it is already done for Android builds. - Linker is invoked via "g++" command instead of "gcc": g++ passes the appropriate magic parameters to the linker, which ensure correct registration of stack unwind tables in dynamic libraries.
2013-08-22Enabled unit tests in std and extra.Vadim Chugunov-2/+0
2013-08-22std: put FileMode/Access->whence-mask in uvio, open/unlink as fns in file::Jeff Olson-89/+75
2013-08-22std: slight refactor on UvFilestream seek behavior, pre-seek-refactorJeff Olson-8/+2
2013-08-22std: rename tmp file paths to go into ./tmp folder in builddirJeff Olson-7/+7
2013-08-22std: more seek testsJeff Olson-1/+71
2013-08-22std: lint appeasement for unused param in condition handlerJeff Olson-1/+1
2013-08-22std: rework file io.. support [p]read,[p]write, impl seek/tell + more testsJeff Olson-16/+125
2013-08-22std: add FileStream::unlink + more testsJeff Olson-2/+52
2013-08-22std: rt::io::file::FileStream fleshed out.. needs more work.. see extendedJeff Olson-15/+94
- change all uses of Path in fn args to &P - FileStream.read assumptions were wrong (libuv file io is non-positional) - the above will mean that we "own" Seek impl info .. should probably push it in UvFileDescriptor.. - needs more tests
2013-08-21std/extra: changing XXX to FIXME; cleanupTim Chevalier-26/+27
* Get rid of by-value-self workarounds; it works now * Remove type annotations, they're not needed anymore
2013-08-21auto merge of #8600 : sfackler/rust/http, r=brsonbors-30/+0
It's an empty stub and as one of the comments notes, doesn't belong in libstd.
2013-08-20Moved .sleep() to Timer.Eric Reed-7/+2
2013-08-19Make IO thread-safe.Eric Reed-7/+3
Each IO handle has a home event loop, which created it. When a task wants to use an IO handle, it must first make sure it is on that home event loop. It uses the scheduler handle in the IO handle to send itself there before starting the IO action. Once the IO action completes, the task restores its previous home state. If it is an AnySched task, then it will be executed on the new scheduler. If it has a normal home, then it will return there before executing any more code after the IO action.
2013-08-19Do not execute the callback before cleaning up resources.Eric Reed-6/+2
2013-08-19Derive Clone for IpAddr and SocketAddrEric Reed-2/+2
2013-08-18Delete std::rt::io::net::httpSteven Fackler-30/+0
It's an empty stub and as one of the comments notes, doesn't belong in libstd.
2013-08-18More spelling corrections.Huon Wilson-2/+2
2013-08-16doc: convert remaining uses of core:: to std::.Huon Wilson-1/+1
2013-08-16doc: correct spelling in documentation.Huon Wilson-3/+3
2013-08-12Forbid pub/priv where it has no effectAlex Crichton-2/+2
Closes #5495
2013-08-09auto merge of #8387 : brson/rust/nooldrt, r=brsonbors-1/+2
2013-08-09Remove the C++ runtime. SayonaraBrian Anderson-1/+2
2013-08-09Fix Ipv6Addr to_str for ::1:x.x.x.x addressesStepan Koltsov-1/+8
Reported by luqmana@
2013-08-08auto merge of #8336 : stepancheg/rust/socket-addr-from-str, r=brsonbors-0/+365
FromStr implemented from scratch. It is overengineered a bit, however. Old implementation handles errors by fail!()-ing. And it has bugs, like it accepts `127.0.0.1::127.0.0.1` as IPv6 address, and does not handle all ipv4-in-ipv6 schemes. So I decided to implement parser from scratch.
2013-08-07Add initial support for a new formatting syntaxAlex Crichton-1/+1
The new macro is available under the name ifmt! (only an intermediate name)
2013-08-06auto merge of #8313 : msullivan/rust/cleanup, r=catamorphismbors-1/+1
2013-08-06Implement FromStr for IpAddr and SocketAddrStepan Koltsov-0/+365
Better than that in rt::uv::net, because it: * handles invalid input explicitly, without fail!() * parses socket address, not just IP * handles various ipv4-in-ipv6 addresses, like 2001:db8:122:344::192.0.2.33 (see http://tools.ietf.org/html/rfc6052 for example) * rejects output like `127.0000000.0.1` * does not allocate heap memory * have unit tests
2013-08-05Updated std::Option, std::Either and std::ResultMarvin Löbel-2/+36
- Made naming schemes consistent between Option, Result and Either - Changed Options Add implementation to work like the maybe monad (return None if any of the inputs is None) - Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead
2013-08-05Get rid of some NOTEs.Michael Sullivan-1/+1
2013-08-04auto merge of #8243 : stepancheg/rust/ipv, r=brsonbors-37/+53
multicast functions now take IpAddr (without port), because they dont't need port. Uv* types renamed: * UvIpAddr -> UvSocketAddr * UvIpv4 -> UvIpv4SocketAddr * UvIpv6 -> UvIpv6SocketAddr "Socket address" is a common name for (ip-address, port) pair (e.g. in sockaddr_in struct). P. S. Are there any backward compatibility concerns? What is std::rt module, is it a part of public API?
2013-08-03remove obsolete `foreach` keywordDaniel Micay-4/+4
this has been replaced by `for`
2013-08-03Rename IpAddr -> SocketAddr, extract IpAddr from SocketAddrStepan Koltsov-37/+53
multicast functions now take IpAddr (without port), because they dont't need port. Uv* types renamed: * UvIpAddr -> UvSocketAddr * UvIpv4 -> UvIpv4SocketAddr * UvIpv6 -> UvIpv6SocketAddr "Socket address" is a common name for (ip-address, port) pair (e.g. in sockaddr_in struct).
2013-08-02replace `range` with an external iteratorDaniel Micay-5/+5
2013-08-01modified local to include an implementation for try_unsafe_borrow::<Task> so ↵toddaaro-2/+2
that the log methods will work
2013-08-01minor tweaks - unboxed the coroutine so that it is no longer a ~ pointer ↵toddaaro-4/+4
inside the task struct, and also added an assert to verify that send is never called inside scheduler context as it is undefined (BROKEN) if that happens