Coming soon - Get a detailed view of why an account is flagged as spam!
view details
5
I'm having a hard time with file/imports from other files I've written
Post Body

Hi y'all, this is driving me crazy, I'm not able to do a simple split of modules into files this is my setup and error:

$ tree src/ && cargo build
src/
├── basic
│   ├── point.rs
│   └── unique_id.rs
├── basic.rs
├── config.rs
├── main.rs
├── object
│   └── void_object.rs
├── object.rs
└── world.rs

2 directories, 11 files
   Compiling fishpool v0.1.0 (/home/***/rust/fishpool)
error[E0432]: unresolved import `crate::config`
 --> src/world.rs:3:5
  |
3 | use crate::config;
  |     ^^^^^^^^^^^^^ no `config` in the root

So I don't get what the issue is, I was having the same issues with the other module (point) until I move it into a "basic" folder as shown in the previous block code.

Here's a copy of world.rs:

use crate::config;
use crate::basic::point::Point; 
pub struct World{ size: Point }

Can somebody give some advise? I've even found guides still using the 2015 way of doing things with the "mod.rs" file in the folder. My cargo.toml has the line edition = "2018"

Author
Account Strength
100%
Account Age
11 years
Verified Email
Yes
Verified Flair
No
Total Karma
116,992
Link Karma
21,025
Comment Karma
95,289
Profile updated: 1 day ago
Posts updated: 8 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
4 years ago