Dazawassa

joined 1 year ago
 

I am pretty new to Rust and I find the docs can be a little confusing sometimes so I'd be really thankful for people who can help me understand this.

So for my uni project we are doing part of it in Rust. and I am having issues understanding how the modules function. So here is my example program.

Main.rs does some stuff and then passes a pointer into a function from a separate Rust file. That function then does some more things and passes a new variable into a function form another separate Rust file as a pointer.

main.rs has mod separate_file1; and then in separate_file 1 there is a mod separate_file2;.

The confusion is that separate_file2 does not read from the same directory as main.rs despite being in it. Instead it looks in a sub-folder under the same name.

If someone could explain to me why it works like this and what the best practice is for using modules I would be really thankful. It's made me struggle a lot.

[–] Dazawassa@programming.dev 0 points 1 year ago (3 children)

One of my lecturers mentioned a way they would get around this was to store all values as ints and then append a . two character before the final one.

[–] Dazawassa@programming.dev 0 points 1 year ago* (last edited 1 year ago) (1 children)

Dieser Konflikt macht immer weniger Sinn.

[–] Dazawassa@programming.dev 1 points 1 year ago (1 children)

If you ever need a mod in the EU timezone I'd be happy to step up. I go between Spain and the UK so it's either GMT 00:00 or 01:00

 

Because I'm in my very early 20s I missed out on the huge Java craze. Everything was Python when I started getting a more formal education and before then all my work was in C++. Knowing more languages would obviously look better on a CV but I mean if I would benefit in a practical sense? I have two friends who are long time Java devs. And recently another friend who generally works with legacy C++ based systems from the early 2000s late 90s period had to work on a bunch of stuff in Java. Java is clearly still in large scale use among older systems. So would it be likely that eventually I would need to work on Java systems myself when my job is mostly JavaScript currently?