nanomsg.rs icon indicating copy to clipboard operation
nanomsg.rs copied to clipboard

Examples from the doc not working.

Open lunemec opened this issue 8 years ago • 1 comments

rustc 1.11.0 (9b21dcd6a 2016-08-15)

src/main.rs:4:5: 4:26 error: unresolved import `std::io::timer::sleep`. Could not find `timer` in `std::io` [E0432]
src/main.rs:4 use std::io::timer::sleep;
                  ^~~~~~~~~~~~~~~~~~~~~
src/main.rs:4:5: 4:26 help: run `rustc --explain E0432` to see a detailed explanation
src/main.rs:3:5: 3:34 error: module `duration` is private
src/main.rs:3 use std::time::duration::Duration;
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main.rs:12:28: 12:34 error: mismatched types [E0308]
src/main.rs:12     let mut buffer = [0u8, ..1024];
                                          ^~~~~~
src/main.rs:12:28: 12:34 help: run `rustc --explain E0308` to see a detailed explanation
src/main.rs:12:28: 12:34 note: expected type `u8`
src/main.rs:12:28: 12:34 note:    found type `std::ops::RangeTo<_>`
src/main.rs:14:11: 14:33 error: no associated item named `milliseconds` found for type `std::time::Duration` in the current scope
src/main.rs:14     sleep(Duration::milliseconds(50));
                         ^~~~~~~~~~~~~~~~~~~~~~
src/main.rs:16:23: 16:28 error: no method named `write` found for type `nanomsg::Socket` in the current scope
src/main.rs:16     match push_socket.write(b"foobar") {
                                     ^~~~~
src/main.rs:16:23: 16:28 help: items from traits can only be used if the trait is in scope; the following trait is implemented but not in scope, perhaps add a `use` for it:
src/main.rs:16:23: 16:28 help: candidate #1: `use std::io::Write`
src/main.rs:21:23: 21:27 error: no method named `read` found for type `nanomsg::Socket` in the current scope
src/main.rs:21     match pull_socket.read(&mut buffer) {
                                     ^~~~
src/main.rs:21:23: 21:27 help: items from traits can only be used if the trait is in scope; the following trait is implemented but not in scope, perhaps add a `use` for it:
src/main.rs:21:23: 21:27 help: candidate #1: `use std::io::Read`
error: aborting due to 4 previous errors
error: Could not compile `nanomsgtest`.

lunemec avatar Sep 09 '16 11:09 lunemec

Hi,

The stored documentation is sadly out-dated, you'll find up-to-date examples in both the doc comments and the examples folder. The problem is already mentioned in issue #147, I think I'll give this a try in the coming weeks.

blabaere avatar Sep 09 '16 12:09 blabaere