Looking through the first example we show the users, I think it's great we get them comfortable with crates.io. That said, the code itself feels like the concept count may a be a bit on the high side for a first example:
use ferris_says::say; // from the previous step
use std::io::{stdout, BufWriter};
fn main() {
let stdout = stdout();
let out = b"Hello fellow Rustaceans!";
let width = 24;
let mut writer = BufWriter::new(stdout.lock());
say(out, width, &mut writer).unwrap();
}
Concepts covered:
If we want to keep the example largely the same, one possibility would be to allow the user to hover over parts of the code and get an explanation for each piece. This would let them have self-directed exploration of the unfamiliar parts.
the purpose of the code example is just for folks to cut and paste and get something working. we can work with the crate owner @mgattozi to improve the interface, but the aim is not to teach concepts but to teach the rust "workflow".
I'm marking this to be resolved before the Edition. I will work with @mgattozi to simplify things a bit.
The example didn't work for me. I had to add this line at the top
extern crate ferris_says;
The example didn't work for me. I had to add this line at the top
extern crate ferris_says;
Maybe that's also part of the Rust workflow? 'If something goes wrong, do what the compiler tells you to fix it' 🥇
$ cargo run
Compiling hello-rust v0.1.0 (/Users/joern.zaefferer/dev/other/hello-rust)
error[E0432]: unresolved import `ferris_says`
--> src/main.rs:1:5
|
1 | use ferris_says::say; // from the previous step
| ^^^^^^^^^^^ Maybe a missing `extern crate ferris_says;`?
error: aborting due to previous error
For more information about this error, try `rustc --explain E0432`.
error: Could not compile `hello-rust`.
To learn more, run the command again with --verbose.
Or we need to switch the edition? There's a little bit about it here: https://rust-lang-nursery.github.io/cli-wg/tutorial/index.html
When the website is launched, the 2018 edition will be the default, yes.
On Dec 3, 2018, at 7:13 AM, Jörn Zaefferer notifications@github.com wrote:
Or we need to switch the edition? There's a little bit about it here: https://rust-lang-nursery.github.io/cli-wg/tutorial/index.html
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
Gotcha. Since the current website advertises the beta site ('Try out the new beta site!'), this is a bit of a trap.
@ashleygwilliams I, too, think, that this code might confuse people who want to learn rust. Usually programmers don't like it, when they are told to execute a piece of code that they do not understand.
The code sample would be perfectly ok, if it was explained.
Same issues for me , then i had to add extern crate ferris_says; had to add this line .
Same issue on OpenBSD 6.4. Fixed adding extern crate ferris_says; to solve.
@drumbsd the example is for the latest stable version of Rust with the edition = "2018" entry in Cargo.toml. This will be generated for you when running $ cargo init with the latest version of Rust installed.
You can update your Rust versions on Mac & Linux using the $ rustup update stable command (I'm not sure about Windows). Hope this is helpful!
I'm going to close this as #838 supersedes it.
// not fixed bug ❌
extern crate ferris_says;
use ferris_says::say;
// from the previous step
use std::io::{stdout, BufWriter};
fn main() {
let stdout = stdout();
let message = String::from("Hello fellow Rustaceans!");
let width = message.chars().count();
let mut writer = BufWriter::new(stdout.lock());
say(message.as_bytes(), width, &mut writer).unwrap();
}

$ rustc --explain E0463
A plugin/crate was declared but cannot be found. Erroneous code example:
cookie_monsterextern crate cake_is_a_lie; // error: can't find crate for cake_is_a_lie
You need to link your code to the relevant crate in order to be able to use it
(through Cargo or the `-L` option of rustc example). Plugins are crates as
well, and you link to them the same way.
Most helpful comment
The example didn't work for me. I had to add this line at the top
extern crate ferris_says;