You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Quote from book (page 358 of PDF): "The following listing focuses on the parse() function. The rest of the code is the same as listing 10.18. You’ll find the code for the following listing in ch10/ch10-render-hex- threadpool/src/main.rs."
Attempting to compile ch10/ch10-render-hex-threadpool fails because the changes in Listing 10.28 do not actually seem to have been made in the sample code provided.
For anyone finding this and having the same problem, you want to make the use declarations in ch10/ch10-render-hex-threadpool/main.rs actually match Listing 10.28, then it will compile. (I haven't checked the rest of the code in main.rs matches Listing 10.28.)
ewen@basadi:~/misc/src/rust/rust-in-action/code/ch10/ch10-render-hex-threadpool$ git diff src
diff --git a/ch10/ch10-render-hex-threadpool/src/main.rs b/ch10/ch10-render-hex-threadpool/src/main.rs
index 55dfd87..5ab02fb 100644
--- a/ch10/ch10-render-hex-threadpool/src/main.rs
+++ b/ch10/ch10-render-hex-threadpool/src/main.rs
@@ -1,6 +1,7 @@
+use std::thread;
use std::env;
-use rayon::prelude::*;
+use crossbeam::channel::{unbounded};
use svg::node::element::path::{Command, Data, Position};
use svg::node::element::{Path, Rectangle};
use svg::Document;
ewen@basadi:~/misc/src/rust/rust-in-action/code/ch10/ch10-render-hex-threadpool$
Ewen
build failure for ch10/ch10-render-hex-threadpool
ewen@basadi:~/misc/src/rust/rust-in-action/code/ch10/ch10-render-hex-threadpool$ cargo build
Compiling autocfg v0.1.7
Compiling semver-parser v0.7.0
Compiling lazy_static v1.4.0
Compiling cfg-if v0.1.10
Compiling scopeguard v1.0.0
Compiling svg v0.6.0
Compiling semver v0.9.0
Compiling crossbeam-utils v0.7.0
Compiling crossbeam-epoch v0.8.0
Compiling rustc_version v0.2.3
Compiling memoffset v0.5.3
Compiling crossbeam-channel v0.4.0
Compiling crossbeam-queue v0.2.0
Compiling crossbeam-deque v0.7.2
Compiling crossbeam v0.7.3
Compiling render-hex v0.1.0 (/Users/ewen/misc/src/rust/rust-in-action/code/ch10/ch10-render-hex-threadpool)
error[E0433]: failed to resolve: use of undeclared crate or module `rayon`
--> src/main.rs:3:5
|
3 | use rayon::prelude::*;
| ^^^^^ use of undeclared crate or module `rayon`
error[E0433]: failed to resolve: use of undeclared crate or module `thread`
--> src/main.rs:151:7
|
151 | thread::spawn(move || {
| ^^^^^^ use of undeclared crate or module `thread`
error[E0425]: cannot find function `unbounded` in this scope
--> src/main.rs:136:28
|
136 | let (todo_tx, todo_rx) = unbounded(); // <5>
| ^^^^^^^^^ not found in this scope
|
help: consider importing this function
|
1 | use crossbeam::unbounded;
|
error[E0425]: cannot find function `unbounded` in this scope
--> src/main.rs:137:34
|
137 | let (results_tx, results_rx) = unbounded(); // <6>
| ^^^^^^^^^ not found in this scope
|
help: consider importing this function
|
1 | use crossbeam::unbounded;
|
Some errors have detailed explanations: E0425, E0433.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `render-hex` due to 4 previous errors
ewen@basadi:~/misc/src/rust/rust-in-action/code/ch10/ch10-render-hex-threadpool$
The text was updated successfully, but these errors were encountered:
Closing issue to clean up my GitHub "issues created" list, since after 18 months it seems clear nothing will happen in this Rust book related repo with the open issues.
Quote from book (page 358 of PDF): "The following listing focuses on the parse() function. The rest of the code is the same as listing 10.18. You’ll find the code for the following listing in ch10/ch10-render-hex- threadpool/src/main.rs."
Attempting to compile
ch10/ch10-render-hex-threadpool
fails because the changes in Listing 10.28 do not actually seem to have been made in the sample code provided.I'd make a PR, but the book author has advised he will not accept PRs so there doesn't seem much point.
For anyone finding this and having the same problem, you want to make the
use
declarations inch10/ch10-render-hex-threadpool/main.rs
actually match Listing 10.28, then it will compile. (I haven't checked the rest of the code inmain.rs
matches Listing 10.28.)Ewen
build failure for ch10/ch10-render-hex-threadpool
The text was updated successfully, but these errors were encountered: