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
I'm talking about this part. In the book it talks about how use is local to a scope and not to a module. I'm just learning Rust and I couldn't find how this applies so I made my research and found out about the reference book that talks about use visibility being local to a module and nowhere the word scope appears. The example in the book also doesn't make any sense while the example in the reference book makes absolute sense about how use applies to modules and how pub use is used to make the name publicly available to other modules.
Unless I'm doing something wrong of course, like I said I'm just learning Rust and I just wanted to report that.
The text was updated successfully, but these errors were encountered:
"Scope" is the correct word to use rather than module, and I think the reference is actually imprecise in this case.
For example, this code doesn't compile because the use is local to the function's scope, not the whole module that both the const and the function are in:
const FOO: NonZeroI8 = NonZeroI8::new(5);
fn bar() {
use std::num::NonZeroI8;
let another = NonZeroI8::new(3);
}
For providing a better example of the effect pub use has, I think this issue is a duplicate of ##2716.
I'm talking about this part. In the book it talks about how
use
is local to ascope
and not to a module. I'm just learning Rust and I couldn't find how this applies so I made my research and found out about the reference book that talks aboutuse
visibility being local to amodule
and nowhere the wordscope
appears. The example in the book also doesn't make any sense while the example in the reference book makes absolute sense about howuse
applies to modules and howpub use
is used to make the name publicly available to othermodules
.Unless I'm doing something wrong of course, like I said I'm just learning Rust and I just wanted to report that.
The text was updated successfully, but these errors were encountered: