3
src/renderers/smart_video_renderer.rs
src/shaders/video_vertex.rs

I want to use video_vertex.rs in smart_video_renderer.rs. I tried:

use super::shaders::video_vertex::*

or

use shaders::video_vertex::*

but it won't import anyway.

I tried How do you use parent module imports in Rust? on which according to, it should be just use two::two; or in my case use shaders::shaders::... so I don't know what to do.

Guerlando OCs
  • 1,886
  • 9
  • 61
  • 150
  • Does this answer your question? [How do I import from a sibling module?](https://stackoverflow.com/questions/30677258/how-do-i-import-from-a-sibling-module) – Jmb Oct 01 '20 at 06:27

1 Answers1

2

In your main.rs or lib.rs you need to declare shaders module with:

pub mod shaders;

And then inside shaders folder you need a mod.rs file with:

pub mod video_vertex;

Then you can use it inside src/renderers/smart_video_renderer.rs with:

use crate::shaders::video_vertex::*;
Chetan Joshi
  • 5,582
  • 4
  • 30
  • 43