9
submitted 1 year ago* (last edited 1 year ago) by nerdblood@programming.dev to c/rust@programming.dev

for example, I have a file structure that looks like this:

action/
   attack.rs
   attack.test.rs
   mod.rs

But this doesn't work in the mod file:

pub mod attack.test;

and neither does:

pub mod "attack.test";

you are viewing a single comment's thread
view the rest of the comments
[-] francorbacho@lemmy.world 9 points 1 year ago

Dots are not allowed. If it's not too much code, you can use inline modules, otherwise you have to stick to:

action/
    attack/test/
        mod.rs

And then:

mod attack::test;
[-] nerdblood@programming.dev 3 points 1 year ago

Thanks, yeah it felt like too many tests to keep in file. I can live with that directory approach. TY!

this post was submitted on 01 Aug 2023
9 points (100.0% liked)

Rust

5981 readers
51 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS