Commit Graph
348 Commits
Author SHA1 Message Date
Paul Lietar 4719fbdb28 Allow start and end of window to match length of underlying slice. 2016-10-22 15:56:02 +02:00
Alex Crichton b84ef90a98 Move Framed from tokio-proto to core
This commit extracts the concrete implementation of `FrameIo` in tokio-proto to
tokio-core under the name `EasyFramed`. This extraction is accompanied with a
new `EasyBuf` buffer type to work with when parsing types.

The purpose of this movement is to provide a clear and easy entry point at the
`FramedIo` layer for those who need it. Eventually these buffer types will get
replaced or moved to the `bytes` crate, but in the interest of an 0.1 release
and remaining backwards compatible with the tokio-core 0.1 release this is
adding a separate module.
2016-10-21 11:46:32 -07:00
Alex Crichton 3ced812993 Merge pull request #55 from oconnor663/read_once
rename Read to ReadOnce and expose it
2016-10-16 13:32:45 -07:00
Jack O'Connor 6789527952 rename ReadOnce back to Read, but keep it exposed 2016-10-15 09:46:59 -04:00
Paul Colomiets b1d02eb598 Implement tokio_core::reactor::Interval 2016-10-10 15:41:57 +03:00
Jack O'Connor da37ad0948 rename Read to ReadOnce and expose it
The other read futures (read_exact, read_until, etc.) all expose their
concrete future types so that function signatures can return them, but
until now `read()` didn't. Exposing it with the name "Read" causes
naming conflicts with the std::io::Read trait, so the easiest thing to
do is to just change the name. Importing std::io::Read under a different
name would've been an option too, but that would probably be annoying
for consumers in the same way it's annoying for us.

The original PR (https://github.com/tokio-rs/tokio-core/pull/29) decided
that "read" was a better name than "read_some", so I'm leaving the top
level functions unchanged. I don't have a strong opinion about it one
way or the other, but I *do* think it's worth bikeshedding a little bit.
Python's asyncio library actually ended up with a very similar issue
around naming inconsistency between the sync and async worlds, and we
can hopefully avoid repeating that: https://bugs.python.org/issue22279
2016-10-08 01:28:39 -04:00
Paul Colomiets 411caa786d Moves when to Timeout from TimeoutToken 2016-10-06 21:11:46 +03:00
Marek Kotewicz a94be1bca9 fixed typo in split.rs 2016-10-05 11:28:46 +02:00
Alex Crichton e32115b1b4 Merge pull request #50 from oberien/read
doc(read): Add number of bytes read to doc
2016-10-04 07:50:44 -07:00
oberien b0033eb463 doc(read): Add number of bytes read to doc 2016-10-04 13:56:31 +02:00
oberien 2545237309 doc(read_until): Fix typo in doc 2016-10-04 13:34:25 +02:00
oberien d2440a4059 fix(read_until): Make read_until resemble BufRead::read_until 2016-09-30 22:12:56 +02:00
oberien ce8a9d460e feat(io): Add read_until 2016-09-30 22:06:43 +02:00
Alex Crichton 866dad2e85 Merge pull request #29 from 3Hren/master
Add `read` free function to read some bytes
2016-09-30 10:14:10 -07:00
Evgeny Safronov f69f748470 chore: fix panic string 2016-09-30 13:20:22 +03:00
Evgeny Safronov 42bbe86cb6 refactor: rename ReadSome to Read
Also `try_nb!` is used.
2016-09-30 13:14:41 +03:00
Evgeny Safronov 4b3472ceae refactor: rename, also make EOF as a valid result 2016-09-29 12:19:20 +03:00
oberien f62d1ddc8d doc(spawn_fn): Fix typo 2016-09-28 03:20:33 +02:00
Alex Crichton 1d40bf14f7 Add Handle::spawn_fn
Acts as a convenience to avoid `futures::lazy`.

Closes #40
2016-09-26 16:52:54 -07:00
Alex Crichton c2e80ebb30 Indiciate need_read requires poll_read
Original intention was that it didn't, but nowadays it does.

Closes #44
2016-09-26 16:27:29 -07:00
Moritz Gunz 326537b861 Fix documentation typos 2016-09-21 18:27:25 +02:00
Alex Crichton 418a973520 Add poll_{read,write} on halves
Closes #32
2016-09-14 11:14:18 -07:00
Evgeny Safronov fb497aba44 Add read_some free function to read some bytes 2016-09-12 19:52:44 +03:00
Simon Bernier St-Pierre 32ccf255b5 update the docs of net::*::bind 2016-09-10 19:12:30 -04:00
Alex Crichton b2ae5ac7c9 Remove unused UdpSocketNew 2016-09-09 09:47:35 -07:00
Carl Lerche 0000210e0c Add io::FramedIo 2016-09-08 23:25:17 -07:00
Alex Crichton 83784fd983 Don't remove timeouts that have fired
Closes #22
2016-09-08 07:47:07 -07:00
Corey Farwell eb643c4d9e Add links in docs to channel function. 2016-09-08 10:33:41 -04:00
Alex Crichton 1f0d2198ad Use a timer heap instead of a timer wheel
In general it's easier to implement and should have more predictable performance
semantics for applications in general. More serious timer usage can go through
`tokio-timer` which has properly configurable timer wheels and such.

Closes #2
Closes #7
2016-09-08 00:06:34 -07:00
Alex Crichton 66cff8e84b Swap Handle/Pinned
* Handle -> Remote
* Pinned -> Handle

All APIs now take a `&Handle` by default and in general can return an immediate
`io::Result` instead of an `IoFuture`. This reflects how most usage will likely
be done through handles rather than remotes, and also all previous functionality
can be recovered with a `oneshot` plus `Remote::spawn`.

Closes #15
2016-09-07 22:12:41 -07:00
Alex Crichton e60002b653 Tweak TaskIo wording and such
* Remove TaskIo
* task_split -> split
* TaskIoRead -> ReadHalf
* TaskIoWrite -> WriteHalf

Closes #18
2016-09-07 22:12:14 -07:00
Alex Crichton 6c045d31ac Reorganize the entire crate:
Renamed APIs

* Loop => reactor::Core
* LoopHandle => reactor::Handle
* LoopPin => reactor::Pinned
* TcpStream => net::TcpStream
* TcpListener => net::TcpListener
* UdpSocket => net::UdpSocket
* Sender => channel::Sender
* Receiver => channel::Receiver
* Timeout => reactor::Timeout
* ReadinessStream => reactor::PollEvented
* All `LoopHandle` methods to construct objects are now free functions on the
  associated types, e.g. `LoopHandle::tcp_listen` is now `TcpListener::bind`
* All APIs taking a `Handle` now take a `Handle` as the last argument
* All future-returning APIs now return concrete types instead of trait objects

Added APIs

* io::Io trait -- Read + Write + ability to poll

Removed without replacement:

* AddSource
* AddTimeout
* IoToken
* TimeoutToken

Closes #3
Closes #6
2016-09-07 22:12:14 -07:00
Alex Crichton 93c61bb384 Merge pull request #21 from frewsxcv/clippy
Address a few clippy suggestions.
2016-09-07 21:19:40 -07:00
Corey Farwell 9fe1d8aeca Remove unnecessary return statements. 2016-09-07 21:30:11 -04:00
Corey Farwell a9d24810be Avoid unnecessary Option::expect indirection. 2016-09-07 21:29:52 -04:00
Corey Farwell 93e1d4778d Use while..let construct for loop. 2016-09-07 21:29:37 -04:00
Corey Farwell d7f76ca549 Add documentation links. 2016-09-07 21:19:34 -04:00
Alex Crichton 815dc803db Merge pull request #19 from kamalmarhubi/read-exact-doc
docs: Fix copypasta in read_exact docs
2016-09-07 15:25:40 -07:00
Kamal Marhubi abf4521300 docs: Fix copypasta in read_exact docs 2016-09-07 18:12:09 -04:00
Alex Crichton 3794cf7f1d Update with Poll/Async changes 2016-09-02 12:17:38 -07:00
Alex Crichton 3282b3ec0d Update to mio 0.6 2016-09-01 22:14:26 -07:00
Carl Lerche 2081bcc430 Track Slab changes 2016-09-01 10:12:15 -07:00
Alex Crichton 6947933b6b Be sure to call poll before doing I/O
Ensures that we can properly clear the readiness bits and manage them correctly.

Closes #10
2016-09-01 09:27:42 -07:00
Alex Crichton 02538d035f Move binaries to examples 2016-09-01 09:18:03 -07:00
Nicolas Bigaouette 376974c349 Fix typo in Loop::run() documentation
Simple typo fixed (`becuase` -> `because`)
2016-08-31 22:35:19 -04:00
Alex Crichton 330ab823b0 Update to futures master
* Remove `LoopData` as it's no longer necessary
* Add `LoopHandle::spawn` to spawn new futures onto an event loop
* Add `LoopData::spawn` to also spawn new futures onto an event loop
* Rejigger the implementation of the event loop a bit (make a slab of futures),
  but otherwise everything else is pretty constant.
2016-08-31 19:00:42 -07:00
Carl Lerche 440a813c5a Track mio master 2016-08-30 14:45:29 -07:00
sinkuu 909f3e923c Fix DropBox's drop 2016-08-28 16:06:45 +09:00
Alex Crichton c820d67d66 Update to mio master 2016-08-27 12:33:31 -07:00
Simon Bernier St-Pierre 32557cd832 fix typo in panic message 2016-08-26 21:47:50 -04:00