events::softtube::Search
let search : softtube::Search = match text.len() { ... }
mismatched types
expected enum `softtube::Search`, found enum `events::softtube::Search`
note: expected type `softtube::Search`
found type `events::softtube::Search`rustc(E0308)
So it says on the second row of the error message that search is of the type softtube::Search, but later, on the last row it says it is the type events::softtube::Search!?! Why Rust? Why are you punishing me?
The first couple of weeks I wrote all Rust code in main.rs just to avoid crap like this, but now I have to bite the bullet and finally learn how to do this. So can anyone help me with this? Please?
Like @RustyYato, I can just guess. It's better if you can provide minimal code that can compile that produce the same error. When trying to reproduce with a minimal code, I tend to find the problem myself. This may help some how?
I think you place your files in wrong folders/directories. If they are all in their correct directories, you don't have to #[path="softtube.rs"] (In fact, this the first time I see it).
If you want to avoid the crate::, bring it into scope by using use ...;
use some::path::to::EnumItem;
let item = EnumItem::Variant;
I am confident that I have completely misunderstood a whole lot of things, but anyway here are my code simplified a lot : https://github.com/Hultan/softtube-error
Go to events.rs and comment out '#[path="softtube.rs"]' and you will get the module error I talked about.
src/misc.rs
file not found for module `misc`
help: name the file either events/misc.rs or events/misc/mod.rs inside the directory "src"rustc(E0583)
Go to events.rs and remove the three 'crate::' and you will get the error message I originally asked about. But it works with the 'crate::' so I am happy with that for now, but just in case you wanted to see exactly how I have messed this up
About my use of the 'mod' keyword in main.rs and events.rs, I have a suspicion that I am using that very wrong. The only thing I am trying to achieve here at this moment is to not have all the code in one file (main.rs). I am not trying to build a "library" (cargo new --lib) or anything...
A few YouTube-videos later and I realized that you can write :
use crate::module;
and
use super::module;
That makes things easier...
I prefer to learn things by doing, until I go completely mad, and then I do what I should have done from the beginning. Read the manual, and learn from others...